The tryton test suite supports to have an option to create a cache of the module database. This is quite convenient as creating a database is a large task. Most of the time it is not required to run the tests on a new database. A new database is only required when the model structure has been changed (i.e: a new field is added) or when XML records are updated.
How to setup the testing cache?
You just need to setup the DB_CACHE
environment variable and point that to any directory. You will need to ensure that this directory exists, so its a good idea to create it. For example you can run the following commands to create it:
$ export DB_CACHE=~/tryton_db_cache
$ mkdir -p $DB_CACHE
Then you can run your modules tests and a dump file of the database will be created. Subsequent runs will restore the backup from the folder and skip the database initialitzation.
How to clear the database cache?
In order to clear the cache, you can just remove the dump file from the server and as the file does not exist it will be recreated.
If you do not want to delete all the backups on your folder, you can just change the DB_CACHE
environment variable to different folders per test.
Happy testing!