NUnit, is it possible to continue executing test after Assert fails?

前端 未结 9 2166
伪装坚强ぢ
伪装坚强ぢ 2020-12-29 19:42

In a test that contains some asserts, for example:

Assert.AreEqual(1,1);
Assert.AreEqual(2,1);
Assert.AreEqual(2,2);

is it possible to let

9条回答
  •  情歌与酒
    2020-12-29 20:33

    Nope. You shouldn't really have more than one assert per test anyway, that reduces the seperation and makes it more difficult to find out which one failed.

    If you have a lot of code that needs executing before the Assert, seperate it out into a [SetUp] function, or make it a seperate procedure.

提交回复
热议问题