Bamboo Nunit解析器任务错误地解析nunit3-console.exe的结果(25个测试被隔离)

时间:2016-10-17 13:36:45

标签: xml-parsing continuous-integration nunit bamboo nunit-console

在Bamboo计划中我有脚本任务,其中脚本体是:

@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%

带参数:

  • $ {bamboo.build.working.directory} \ SRC \包\ NUnit.ConsoleRunner.3.5.0 \工具\ nunit3-console.exe“
  • “$ {bamboo.build.working.directory} \ SRC \ CutwiseSeleniumTests \ CutwiseSeleniumTests.csproj”
  • “TestResult.xml”
  • “调试”

在我收到正确的TestResult.xml文件后,此任务完美无缺。

但是在下一个最终任务中--Nunit Parser我得到了另一个错误的结果,看起来Nunit Task在运行nunit3-console.exe的脚本中没有参数“format = nunit2”也无法正常工作。

问题是Nunit解析器将 25个测试定义为跳过 Test Results

但在TestResult.xml中,我看到下一个测试摘要:

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

这是我的TestResult.xml TestResult.xml

可能是什么问题,如何解决?

1 个答案:

答案 0 :(得分:1)

正如查理评论的那样,有一种nunit3格式的结果而不是nunit2。我将脚本更改为

@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%

我将Bamboo的论点传递给

 "${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"