What is the order of execution in NUnit?

后端 未结 6 525
滥情空心
滥情空心 2021-02-05 19:09

I have been doing some research on test driven development and find it pretty cool.

One of the things I came across was that when you write your tests, there is an orde

6条回答
  •  无人及你
    2021-02-05 20:11

    NUnit 3.0 has made some changes regarding unit tests attributes as indicated here:

    TestFixtureSetUpAttribute and TestFixtureTearDownAttribute continue to be supported as synonyms for OneTimeSetUpAttribute and OneTimeTearDownAttribute in test fixtures, but are deprecated.

    Since SetUpAttribute and TearDownAttribute are used in two different ways, it's not possible to simply deprecate their usage in SetUpFixture. They have been disallowed in that context, which is a breaking change.

    So, execution order is the following:

    • OneTimeSetUp
    • Setup
    • Test
    • TearDown
    • Setup
    • Test
    • TearDown
    • OneTimeTearDown

提交回复
热议问题