Reputation: 1714
We are trying to generate automated test reports from our NUnit tests by parsing the output .xml file.
If a test fails, the output is printed:
<test-case id="1013" name="TestThatFails" fullname="TestThatFails" methodname="TestThatFails" classname="TestThatFails" runstate="Runnable" seed="921492075" result="Failed" start-time="2017-10-17 01:34:26Z" end-time="2017-10-17 01:34:33Z" duration="6.367749" asserts="1">
<failure>
<message><![CDATA[ Expected: 136 But was: 135 ]]>/message>
<stack-trace><![CDATA[ *stack trace here* ]]></stack-trace>
</failure>
<assertions>
<assertion result="Failed">
<message><![CDATA[ Expected: 136 But was: 135 ]]>/message>
<stack-trace><![CDATA[ *stack trace here* ]]></stack-trace>
</assertion>
</assertions>
</test-case>
However if the test passes, no information about the expected or actual values are written:
<test-case id="1014" name="TestThatPasses" fullname="TestThatPasses" methodname="TestThatPasses" classname="TestThatPasses" runstate="Runnable" seed="1565993596" result="Passed" start-time="2017-10-17 01:34:33Z" end-time="2017-10-17 01:34:33Z" duration="0.003047" asserts="2" />
Is there any way to get all the assertions, even if the tests pass?
Upvotes: 0
Views: 762
Reputation: 13726
As you have seen, the way to get reports from NUnit is by reading the XML output. That output contains information about assertions that failed, but not about those that succeeded. Adding info about passing assertions would be a new feature, one we envisioned doing eventually but for which there is no current schedule. Requesting the feature would be a good way to make it happen sooner.
Upvotes: 1