The tests are currently written in such a way as to depend on the success of previous tests in order to ensure the database is in the proper state. Currently, I am having problems running tests multiple times, as they do not clean up properly. This situation is is undesirable for several reasons:
1) Tests should always be able to be run stand-alone with no dependencies, this is the point of unit tests.
2) SBT can run tests in a parallelized fashion, but only if they are isolated. This is especially problematic for our tests since they may refer to the same tables/database schemas. So even if each test makes no assumptions and uses fixtures to set up the database properly, it could still fail if another test "stomps" all of the data it just loaded.
To remedy these:
1) Fixtures must be created that can put the database into an expected state and then always clean up after the test, even on failure (using try, catch, finally)
2) For "real" databases, each test should take place in a randomly created schema or alternatively use randomly created table names. Whichever is easier.
3) SQLite should be modified to use a randomized file name
The tests are currently written in such a way as to depend on the success of previous tests in order to ensure the database is in the proper state. Currently, I am having problems running tests multiple times, as they do not clean up properly. This situation is is undesirable for several reasons:
1) Tests should always be able to be run stand-alone with no dependencies, this is the point of unit tests.
2) SBT can run tests in a parallelized fashion, but only if they are isolated. This is especially problematic for our tests since they may refer to the same tables/database schemas. So even if each test makes no assumptions and uses fixtures to set up the database properly, it could still fail if another test "stomps" all of the data it just loaded.
To remedy these:
1) Fixtures must be created that can put the database into an expected state and then always clean up after the test, even on failure (using try, catch, finally)
2) For "real" databases, each test should take place in a randomly created schema or alternatively use randomly created table names. Whichever is easier.
3) SQLite should be modified to use a randomized file name