NUnit TestFixture Execution Question
I am trying to test some legacy database code. I have many situations where I want to
- Set database in empty state
For a group of tests do the following for each group:
- for a group of tests, set the db to an inital test state
- run those tests
- return db back to empty state
In NUnit, when using a TestFixture am I guaranteed that the entire fixture's test will be run together as well as the TestF开发者_如何学GoixtureTearDown before the next TestFixture gets processed? I've tried this using the Visual Studio test stuff and this doesn't appear to be the case.
The main reason for trying to do this, is that sometimes the process of getting the db to the state in step 2 can be expensive and I don't want to have to run this for each of the test cases.
TestFixtureTearDown
will be executed once the tests with the TestFixture
are completed. Coupling this with TestFixtureSetUp
should provide the beahivor your are seeking on a TestFixture
basis.
The Unit Testing Framework in Visual Studio does not have the same syntax as NUnit. While the test approach is the same for all xUnit based frameworks the syntax will vary.
精彩评论