nunit-console return codes

4,649 views
Skip to first unread message

Vexul

unread,
Mar 11, 2010, 1:44:01 AM3/11/10
to NUnit-Discuss
Hi.

Where can I see return codes spec for nunit-console?
For example, what mean return code "-100"?

Thanks.

Charlie Poole

unread,
Mar 11, 2010, 9:38:44 AM3/11/10
to nunit-...@googlegroups.com
Hi,

This should be in the docs - but is not! Please file a bug to
remind us to add it.

Meanwhile, from the source code, we have this key...

public static readonly int OK = 0;
public static readonly int INVALID_ARG = -1;
public static readonly int FILE_NOT_FOUND = -2;
public static readonly int FIXTURE_NOT_FOUND = -3;
public static readonly int UNEXPECTED_ERROR = -100;

Additionally, positive values give a count of failed tests
in the run.

The -100 return code is a catch-all, usually indicating an
unhandled exception in your application or test. It should
normally come with a stack trace.

Charlie

> --
> You received this message because you are subscribed to the
> Google Groups "NUnit-Discuss" group.
> To post to this group, send email to nunit-...@googlegroups.com.
> To unsubscribe from this group, send email to
> nunit-discus...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/nunit-discuss?hl=en.
>
>

Steve Robbins

unread,
Feb 14, 2017, 1:47:22 PM2/14/17
to NUnit-Discuss, cha...@nunit.com
Hi,

I apologize in advance for replying to an ancient thread and for asking about NUnit 2.6.4 -- which I know is also ancient and unsupported; but here goes.

We have a CI job that runs tests using NUnit 2.6.4.  Until recently, it was pretty solid, but then we added 10,000 test cases (using generator functions) and now it regularly fails with exit code 255.  The weird part is that it does not generate the usual "test summary" output ("Tests run, Errors, Failures, etc"), but rather the output leaves off in the middle of the trail of dots and the next line is the MSBuild output: "... error MSB6006: "nunit-console.exe" exited with code 255." Also: we don't have the usual xml file output from option "/xml=tests.xml".


So I've looked at the v2 code on github [1] and found the 4 standard return codes Charlie already quoted. And I found the code where the integer "returnCode" is computed from the TestResult. But this code path should emit the test summary and the xml file also -- both of which are missing in my case. So my best guess is that "testRunner.Run()" -- and therefore ConsoleUi.Execute()" exited with an exception. However, the Runner.cs code calls this from within a try/catch that writes the unhandled exception to the console and returns ConsoleUi.UNEXPECTED_ERROR which is -100; but (a) I don't see the unhandled exception, and (b) the return code is apparently 255, not -100.

So I'm stumped. Does anyone know how nunit-console could be returning 255?

Also puzzling: the job fails regularly under Jenkins CI on our build server for which NUnit reports the following environment:

    Runtime Environment - 
       OS Version: Microsoft Windows NT 6.2.9200.0
      CLR Version: 2.0.50727.8009 ( Net 3.5 )

But I cannot get it to fail on my developer machine:

    Runtime Environment -
       OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
      CLR Version: 2.0.50727.5485 ( Net 3.5 )

Thanks!
-Steve





Charlie Poole

unread,
Feb 14, 2017, 2:35:02 PM2/14/17
to NUnit-Discuss
Hi Steve,

Try running with --labels:All. This might point to a particular test
that is causing the problem. The problem may be in the last test
displayed or in the test that would normally have followed it, but
didn't get far enough to display.

Charlie
> --
> You received this message because you are subscribed to the Google Groups
> "NUnit-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nunit-discus...@googlegroups.com.
> To post to this group, send email to nunit-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/nunit-discuss.
> For more options, visit https://groups.google.com/d/optout.

Steve Robbins

unread,
Feb 27, 2017, 9:04:57 PM2/27/17
to NUnit-Discuss, cha...@nunit.com
Hello,

On Tuesday, 14 February 2017 13:35:02 UTC-6, Charlie Poole wrote: 

Try running with --labels:All. This might point to a particular test
that is causing the problem.

Thanks; that is a good idea.  I did that, then turned off the "offending" tests with ignore.   But all that happened was a different test began failing.  

Today, I got desperate enough to look in the windows Event Log and discovered that the application did crash with a fault in one of the DLLs under test.  So the answer to my original question seems to be: return code 255 means the application (nunit-console) crashed.

-Steve


Reply all
Reply to author
Forward
0 new messages