如何配置NUnit TestResult输出以包括预期结果和实际结果

时间:2016-03-14 20:12:13

标签: nunit

我正在使用NUnit:2.6.4.14350版本。从NUnit生成的输出没有每个测试用例的ExpectedResult属性值和ActaulResult属性值。因此,我想将它们包含在NUnit TestResult输出中。 电流输出: "测试用例名称=" MyTestClass.TC-40"描述="两个数的和:SUM(2,3)"执行="真"结果="成功"成功="真"时间=#&34; 0.347"断言=" 1""

期望的输出: "测试用例名称=" MyTestClass.TC-40"描述="两个数的和:SUM(2,3)"执行="真"结果="成功"成功="真"时间=#&34; 0.347"断言=" 1" expectedresult =" 5" actualresult =" 5" "

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

There is no capability in NUnit to add attributes or elements to the XML result. You would have to modify NUnit to do this.

If you use an equality constraint, the error message contains both the expected and actual values. Normally, there is no message for success but you can use Assert.Success to create one.

You could request a new feature for a future version of NUnit, of course.