Retrieve NUnit Result file (xml) when using MSBuild NUnit Task

Dear all,

is there a way to retrieve the nunit testresult.xml file when using the teamcity nunint task with msbuild?

I have teamcity 3.1.1 installed.


Thanks!

12 comments

Hi,

Possibly, you need artifact publishing functionality? Please take a look at
http://www.jetbrains.net/confluence/display/TCD3/Build+Artifact

Kind regards,
KIR

0

Thanks for the hint.
But my problem is that I cannot figure out if and (if yes) where the NUnit testresult.xml file is located after running the test.

Thanks

0

Hello,
I have created an issue for that at http://www.jetbrains.net/tracker/issue/TW-5366, please watch/vote for it.

As workaround you have to use TeamCity commandline Test runner. It requires the following xml file as parameters:

_PATH_TO_ASSEMBLY_ .... _PATH_TO_ASSEMBLYN_
To run the tests, please write the following in your msbuild:
<Exec Command="$(teamcity_dotnet_nunitlauncher) @@ PATHTO_FAILE_CONTAINING_THE_XML_" />

Thanks!

0

Hi,

thanks for the fast response. I tried it with the xml file as arguments but I get the following error:


JetBrains.BuildServer.NAntLoggers.CommandLine.XmlTestArgumentsParser.JetBrains.BuildServer.NAntLoggers.CommandLine.ICommandLineParser.Parse(String[] )
at JetBrains.BuildServer.NAntLoggers.NUnitLauncher2.Parse(String[] args) in c:\Agent\work\5eba606ec9e31e70\src\NUnitBootstrap\src\NUnitLauncher2.cs:line 150
2008-07-01 17:29:55,406 ERROR JetBrains.BuildServer.NAntLoggers.NUnitLauncher2 - Compatible parser was not found
JetBrains.BuildServer.NUnitLauncher.exe @@ <xml-arguments-file>

JetBrains.BuildServer.NUnitLauncher.exe {v1.1|v2.0|ANY} {MSIL|x86|x64} Plugin{|Plugin...} [(;| )]]>[...]]
Plugin:
NUnit-2.2.10
NUnit-2.2.9-VSTS
NUnit-2.4.6
NUnit-Auto



2008-07-01 17:29:55,406 ERROR JetBrains.BuildServer.NAntLoggers.NUnitLauncher2 - Failed to parse arguments
E:\ContinuousBuild\FRCT\Setup\BuildScripts\MessageManager.build(28,4): error MSB3073: The command "C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe @@ E:\ContinuousBuild\FRCT\Setup\BuildScripts\..\Components\MessageManager\Tests\TSUtilityComponents\Test.xml" exited with code -1.
Done Building Project "E:\ContinuousBuild\FRCT\Setup\BuildScripts\MessageManager.build" (Build;Coverage target(s)) -- FAILED.
Done Building Project "E:\ContinuousBuild\FRCT\Setup\BuildScripts\Build.build.teamcity.patch.tcprojx" (default targets) -- FAILED.


Please take a look into my configuration file (attached).


Many Thanks in advance.



Attachment(s):
Test.xml
0

Sorry, seems I have just send you broken xml file. Please check weather there is quote (") after ext=".xml in the line starting with formatter.

0

this works, but it seems to generate an output file for each test assembly... is there any way to get one complete testresults.xml file like you normally get with nunit-console?

0

It is impossible in the current TeamCity version. I have added the issue in our tracker for that issue.
Please watch the issue on that at http://www.jetbrains.net:8888/tracker/issue/TW-5392

Thanks!

0

Hi Eugene,
I am trying to do the same thing here but the test.xml file sample doesn't contain any parameters to specify include-category and exclude-category for the nunit tests.  Can you let me know how I might run this using categories?

Thanks for your help.

0

Found the problem, seems the workaround is not required anymore.  

Our original nant nunit2 target was simply setup wrong to produce the xml-file.

BR

/Nikolaj


I have been trying to get this work-around up and running with NANT, but have problems getting commandline tool to accept the xml file as input.

The line:
<Exec Command="$(teamcity_dotnet_nunitlauncher) @@ PATHTO_FAILE_CONTAINING_THE_XML_" />

would become something like:

<exec program="$(teamcity_dotnet_nunitlauncher)" commandline="path_to_xml_file"/>

But I can't get this to work.

- It doesn't seems like the teamcity_dotnet_nunitlauncher can take an xml file as a parameter.
- Can't find arguments for commandline to enable it to write the test results to a file

Running the following line works:
<exec program="C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe" commandline="D:\TestSites\TestSite1\code\build\test\TestSuite.dll"/>

But as far as I understand from the workaround i need to use extra parameters for it to actually save the xml file.

I hope you can help me with this.

BR

/Nikolaj

0

Please try running NUnit runner without arguments. It will dump all supported parameters.
I believe you can write those parameters using commandline switches.

Xml file parameters is not documented and used internally. This xml file format may change in next releases.
Could you please attach a sample xml file to check.

0

Sorry for the late return and thanks for the reply.

As I tried to comment on my own post I already solved my problem. Turns out the nant target was not correct for producing xml output from NUnit - fixing this solved the problem.

Best Regards

/Nikolaj

0

Please sign in to leave a comment.