views:

853

answers:

3

How do you in any of the common .NET testing frameworks MSTest, NUnit, MbUnit, or xUnit.NET get the command line test runner to output a simple yes/no or true/false or 1/0 on whether all the tests passed or failed?

I'm open to workarounds like:
1) no output if all the tests passed, output if anything fails.
2) count of tests that failed. I could look for zero or non-zero values.
3) other things similiar to #1 or #2

Which of these frameworks provide this kind of capability. I did some playing with MSTest today and didn't see a way to make MSTest.exe output something I could use.

+2  A: 

they all output XML if you want (esp MSTEST). You can use XSLT like my version for MSTEST

Preet Sangha
Should I take the total number of tests and compare that to "passed"? Will that avoid adding up the errors, failed, timeout, aborted, etc... ?
tyndall
+1 by the way... I like this idea.
tyndall
No there are lots of stats. I used Found as as example of what should have been attempted (removing ignored I think)
Preet Sangha
A: 

Have a look at Gallio, a framework and other tools (test runner, etc.) that MbUnit is built on, but that also handles the outputs MSTest, NUnit, RSpec, etc.

EDIT: So, while that isn't exactly what you asked for, if you use the output from the Gallio test-runner, then you've got free support for the test formats - its essentially a standard output.

Matt Enright
A: 

MSTest and most other runners return an exitcode you can check on.

Serge van den Oever