当测试失败转移到隔离区时,防止Bamboo失败

时间:2014-04-02 06:49:42

标签: c# msbuild jobs bamboo

Bamboo 上,我有MSBuild个用于构建和运行测试的工作。

它工作正常 - 但我想使用test quarantine选项,所以当我将一些测试移到隔离区(这个移动的测试只是失败的那个)时,作业将被标记为成功

我将一个失败的测试移到隔离区,但作业被标记为失败

配置:

Job - > TasksCommand名为Test runner

可执行文件 = VSTest.Console

参数 =" WebServiceTestClient.dll" /记录器:TRX

在运行失败的测试隔离后,我得到了日志

01-Apr-2014 10:59:44  Total tests: 62. Passed: 61. Failed: 1. Skipped: 0. 
01-Apr-2014 10:59:44  Test Run Failed. 
01-Apr-2014 10:59:44  Test execution time: 10.1296 Minutes 
01-Apr-2014 10:59:44  Failing task since return code of [C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\VSTest.Console.exe "WebServiceTestClient.dll" /Logger:trx] was 1 while expected 0 
01-Apr-2014 10:59:44  Finished task 'Test runner' 
01-Apr-2014 10:59:44  Starting task 'Parse test logs' of type 'com.atlassian.bamboo.plugin.dotnet:mstest' 
01-Apr-2014 10:59:44  Parsing test results... 
01-Apr-2014 10:59:45  Failing task since 1 failing test cases were found. 

作业被标记为失败,但随后:

01-Apr-2014 10:59:45  Changing Task Result to SUCCESS as all failed tests were quarantined. 
01-Apr-2014 10:59:45  Finished task 'Parse test logs' 
01-Apr-2014 10:59:45  Running post build plugin 'NCover Results Collector' 
01-Apr-2014 10:59:45  Running post build plugin 'Clover Results Collector' 
01-Apr-2014 10:59:45  Running post build plugin 'Artifact Copier' 
01-Apr-2014 10:59:45  Finalising the build... 

不幸的是输出是: enter image description here

2 个答案:

答案 0 :(得分:1)

问题在于工作结果是失败。

您可以通过ant脚本运行测试,只要目标成功执行,您就可以通过。在我的Bamboo设置中,我像这样运行所有的单元测试,并且在运行测试后,我寻找测试结果,如果缺少一个,则生成失败的测试结果(例如,如果cppunit exe抛出异常并且没有写出结果)。

然后将最后一个阶段设置为检查测试结果(可以是您从中运行测试的同一阶段,也可以是以后的阶段)。

答案 1 :(得分:-1)

  • 选择信息中心>所有计划> #buildresult转到测试失败的构建结果。
  • 点击Quarantine for the faileding test(在' Build Result Summary'屏幕中)。

https://confluence.atlassian.com/bamboo/quarantining-failing-tests-289276886.html