开发者

NUnit TestFixture Execution Question

I am trying to test some legacy database code. I have many situations where I want to

  1. Set database in empty state

For a group of tests do the following for each group:

  1. for a group of tests, set the db to an inital test state
  2. run those tests
  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜