【问题标题】:Bamboo Nunit parser task incorrectly parses the results from nunit3-console.exe (25 tests were quarantined)Bamboo Nunit 解析器任务错误地解析了 nunit3-console.exe 的结果(25 个测试被隔离)
【发布时间】:2016-10-17 13:36:44
【问题描述】:

在 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\packages\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe"
  • "${bamboo.build.working.directory}\src\CutwiseSeleniumTests\CutwiseSeleniumTests.csproj"
  • “TestResult.xml”
  • “调试”

此任务完美运行,之后我收到正确的 TestResult.xml 文件。

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

问题在于 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

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

【问题讨论】:

  • 您的 TestResult.xml 具有正确的数据,但不是 NUnit2 格式。我建议在命令行执行之前回显它,这样你就可以看到实际传递给 NUnit 的内容。

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


【解决方案1】:

作为 Charlie cmets,有一个 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"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-13
    • 1970-01-01
    • 1970-01-01
    • 2012-01-03
    • 1970-01-01
    相关资源
    最近更新 更多