本文介绍了Bamboo Nunit解析器任务错误地解析了nunit3-console.exe的结果(隔离了25个测试)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Bamboo计划中,我有脚本任务,脚本主体为:

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%

带有参数:

  • $ {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文件之后,此任务可以完美地工作.

This task work perfectly, after it I receive correct TestResult.xml file.

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

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.

问题在于Nunit解析器将 25个测试定义为已跳过 测试结果

The problem is that Nunit parser defined 25 tests as skipped Test Results

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

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

这是我的TestResult.xml TestResult.xml

Here is my TestResult.xml TestResult.xml

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

What could be the problem, how to solve it?

推荐答案

正如查理(Charlie)所说,存在nunit3格式的结果,而不是nunit2.我将脚本更改为

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%

我将Bamboo的论点作为

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"

这篇关于Bamboo Nunit解析器任务错误地解析了nunit3-console.exe的结果(隔离了25个测试)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 14:21