This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi
How do you guys unit test the conditions of a Linq query? Or do you have a database that expects to be in a certain state at a certain time during the test run?
Cheers
Ivan
|
|
|
I'm sorry I didn't see the forum for the beta of 2.0
|
|
|
For all of our LightSpeed testing, we have a database (one for each engine, e.g. SQLite, MySQL, etc.) and the tests run against that. We use a base TestFixture class with setup and teardown methods to ensure that all tests run in their own transactions and that the transactions get rolled back after each test. The teardown method also calls Repository.CompleteUnitOfWork(false). Consequently, the state of the database is an invariant across tests. It's not really a matter of being in a certain state "at a certain time" because that implies variance over time, fragile order dependency and nonreproducible test failures. The database definitions and content are kept in scripts which are run at the beginning of each automated build, so even if someone does write a bad test which mucks up the database, it gets restored to the expected state before the next test run. |
|