NUnit的,是有可能继续断言失败后执行测试? [英] NUnit, is it possible to continue executing test after Assert fails?

查看:174
本文介绍了NUnit的,是有可能继续断言失败后执行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个测试,包含了一些断言,例如:

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 the test keep running after it fails at some point? In the example, first condition is true, second fails and the test stops. I'd like to evaluate also the following condition.

推荐答案

NUnit的3增加了 Assert.Multiple 方法和 MultipleAsserts 属性。请参见 https://github.com/nunit/dev/wiki/Multiple-Asserts

NUnit 3 adds Assert.Multiple method and MultipleAsserts attribute. See https://github.com/nunit/dev/wiki/Multiple-Asserts.

这篇关于NUnit的,是有可能继续断言失败后执行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆