0
votes

So I'm manually importing my NUnit results and using the XML report processing build feature to process them. However I want to exit a Powershell step if any of the tests have failed (I'm destroying some instance programatically, but would rather keep them for troubleshooting if a test has failed).

The build feature gives me:

[Step 1/1] Failed tests detected

How can I programatically (in powershell) detect when this is the case?

1

1 Answers

1
votes

Assuming your Powershell script is invoking nunit3-console, you should examine the return code. A non-zero positive result indicates the number of test cases that failed. A negative result indicates some other kind of error, like file not found.