Accessing ReturnCode from NUnitTeamCity task

The ReturnCode property of the NUnitTeamCity task seems like an obvious candidate for something that should be accessible when the task exits. However, if I define a task like this:

 

<NUnitTeamCity
    Assemblies="@(TestAssemblies)"
    NUnitVersion="NUnit-2.5.4"
    >
 
 
    <Output TaskParameter="ReturnCode" ItemName="NUnitExitCodes"/>
</NUnitTeamCity>


I receive the following message:

error MSB4065: The "ReturnCode" parameter is not marked for output by the "NUnitTeamCity" task.

I think this should be a simple matter of adding an attribute - is this something you could fix in the next release?
3 comments

I've added an issue into issue tracker at http://youtrack.jetbrains.net/issue/TW-12754, please vote for it.
Note, I've added a question for you there.

0

Hi Eugene, thanks for looking at this. I've commented on the issue in the tracking system, but I'm copying some of the reply here to see if anyone has another suggestion to achieve what I want.
The scenario I am thinking of is where I want to run tests from multiple assemblies by using MSBuild batching, and I want to:

  • continue running tests on all assemblies even if some of the tests fail,
  • fail the build afterwards if any of the tests failed, so that subsequent build stages do not occur.

    At the moment this is not easy with the NUnitTeamCity task. Is there another way to achieve this with the current tools?

    0

    You may switch to using TeamCity NUnit launcher.
    Please have a look at http://confluence.jetbrains.net/display/TCD5/TeamCity+NUnit+Test+Launcher for more details.

    0

    Please sign in to leave a comment.