NUnit - cleanup after test failure

后端 未结 11 954
盖世英雄少女心
盖世英雄少女心 2020-12-24 05:09

We have some NUnit tests that access the database. When one of them fails it can leave database in inconsistent state - which is not an issue, since we rebuild database for

11条回答
  •  情歌与酒
    2020-12-24 06:01

    You can add a [TearDown] method with
    if (TestContext.CurrentContext.Result.Status != TestStatus.Passed)
    some code to be executed if test failed.

提交回复
热议问题