问题
In Bamboo plan I have script-task, where script body is:
@echo off
SET nucpath=%1
SET projectvar=%2
SET xmlvar=%3
CALL SET xmlvar=%%xmlvar:-xml=--result%%
SET outputvar=%4;format=nunit2
SHIFT
SHIFT
SHIFT
SET remvar=%2
:loop
SHIFT
if [%1]==[] GOTO afterloop
SET remvar=%remvar% %2
GOTO loop
:afterloop
REM Ensure PATH includes nunit3-console.exe or edit the line below to include full path.
%nucpath% %projectvar% %xmlvar% %outputvar% %remvar%
with arguments:
- ${bamboo.build.working.directory}\src\packages\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe"
- "${bamboo.build.working.directory}\src\CutwiseSeleniumTests\CutwiseSeleniumTests.csproj"
- "TestResult.xml"
- "Debug"
This task work perfectly, after it I receive correct TestResult.xml file.
But in the next final task - Nunit Parser I get another wrong result, it looks like Nunit Task doesn't work properly despite parameter "format=nunit2" in script running nunit3-console.exe.
The problem is that Nunit parser defined 25 tests as skipped Test Results
But in TestResult.xml I see next Test summary:
17-Oct-2016 16:41:01 Test Run Summary
17-Oct-2016 16:41:01 Overall result: Failed
17-Oct-2016 16:41:01 Test Count: 45, Passed: 35, Failed: 1, Inconclusive: 0, Skipped: 9
17-Oct-2016 16:41:01 Failed Tests - Failures: 0, Errors: 1, Invalid: 0
17-Oct-2016 16:41:01 Skipped Tests - Ignored: 9, Explicit: 0, Other: 0
17-Oct-2016 16:41:01 Start time: 2016-10-17 13:35:48Z
17-Oct-2016 16:41:01 End time: 2016-10-17 13:41:01Z
17-Oct-2016 16:41:01 Duration: 313.298 seconds
Here is my TestResult.xml TestResult.xml
What could be the problem, how to solve it?
回答1:
As Charlie comments, there was a nunit3 format of result instead of nunit2. I change script to
@echo on
SET nucpath=%1
SET projectvar=%2
SET xmlvar=%3
CALL SET xmlvar=%%xmlvar:-xml=--result%%
SET outputvar=%4;format=nunit2
SHIFT
SHIFT
SHIFT
SET remvar=%2
:loop
SHIFT
if [%2]==[] GOTO afterloop
SET remvar=%remvar% %2
GOTO loop
:afterloop
REM Ensure PATH includes nunit4-console.exe or edit the line below to include full path.
%nucpath% %projectvar% %xmlvar% %outputvar% %remvar%
And I pass Bamboo's arguments as
"${bamboo.build.working.directory}\src\packages\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe", "${bamboo.build.working.directory}\src\CutwiseSeleniumTests\CutwiseSeleniumTests.csproj", -xml="TestResult.xml", --config="Debug"
来源:https://stackoverflow.com/questions/40087902/bamboo-nunit-parser-task-incorrectly-parses-the-results-from-nunit3-console-exe