Tests

The unit tests use a sqlite database, which resides in tests/src/testDB.sqlite. When running the tests, this file will be copied to tests/src/testDB_tmp.sqlite, which actually will be used for the tests!

If new database entries are required, please put them inside tests/src/testDB.sqlite, since the other database file will be overridden with every test run.

The background for this is that the tests should run on top of a clean database. Therefore, tests/src/testDB_tmp.sqlite is excluded from the repository.

Database depended test developing scheme
  • Do not alter or delete database entries which are needed by other tests.

    • Rather create new entries which can be altered or deleted.

    • SELECT statements are good though!

  • Do not clean up database entries after tests.

    • When your tests create entries, debugging is easier if you can check these entries after running the tests.

    • Additionally, the database will be reset when you rerun the tests.

    • However, if your tests purpose is to delete entries, do it!

  • Try to add as little new entries to tests/src/testDB.sqlite as possible.

    • A bloated database file will get more difficult to debug.

    • Rather let the tests create new database entries which need them.

Related pages