Wednesday, November 13, 2013

Extending Easytest to support Drop & Restore for SQLite, ASA , LocalDB

XAF includes the EasyTest functional test framework which as all DevExpress tools is an extensible beast. To learn more about EasyTest I suggest you go through our documentation. So, it was just about time to include a few projects in eXpandFramework to host custom commands and extensions contributed by our community.

Starting from next eXpandFramework version 13.1.10 in the root of our repository you will find three extra projects which contain:

  1. The FillDataTimeValue command as described in How to: Implement a Custom EasyTest Command.
  2. The custom database operations to support Drop & Restore for SQLite, ASA, LocalDB contributed by Markus Dütting!

The Drop and Restore Preprocessor Directives are already supported for Access, MSSql databases and to learn how to use them together with other commands look at EasyTest Script Reference.

Following are some notes from Markus.

  1. SQLite: just deletes the file DBSourceLocation (DropDB) or copys the file (RestoreDB) specified by Backupfilename to DBSourceLocation. Tested with System.Data.SQLite 1.0.88.0.
  2. LocalDB: uses the "DROP DATABASE" (DropDB) and "RESTORE DATABASE" (RestoreDB) command. DropDB or more exactly empty database creation doesn't correctly work with the MSSQL XPO Provider in 13.1.7 with LocalDB. It seems LocalDB's "CREATE DATABASE" command returns before the database is "connectable". Therefore only RestoreDB works, as i added code which tries to connect to the restored or new database in a loop up to 10 seconds. If you omit Backupfilename than RestoreDB creates an empty database. Tested with LocalDB v11.0 which comes with VS 2012.
  3. SAP SQL Anywhere: uses the "DROP DATABASE" (DropDB) command from the Utility Database that deletes the database file specified by DBSourceLocation and stops it before if it is running. RestoreDB does a DropDB just in case before it creates an empty database if Backupfilename is not specified, otherwise it copies the database and log file if specified by Backupfilename or restores them from the therein specified archive. After that it starts the database. Tested with SA16.

In addition, to spare our time, Markus contributed a sample config which can be found at http://goo.gl/1h4IMV.

Big thanks to Markus Dütting and we look forward for more EasyTest command and extensions from all XAFers our there. If you interested to share your own work you can find me at apostolisb at devexpress.

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

0 comments:

Post a Comment