在Bamboo Build服务器中以XML格式发布MS测试结果

时间:2014-09-23 10:22:48

标签: unit-testing visual-studio-2012 mstest bamboo

我需要在Bamboo版本中从MS Testxml格式解析为.trx格式。

为此,我添加了一个任务MS test parser并执行竹子手动运行,但我不知道我能用XML获得结果。

请建议如何做同样的事。

这是构建日志

simple  23-Sep-2014 15:39:07    Build CI-Demo-Tethys-RG - DB-CI - Default Job #27 (CID-DBCI-JOB1-27) started building on agent Default Agent
simple  23-Sep-2014 15:39:07    Build working directory is C:\Users\neeraj.dubey\bamboo-home\xml-data\build-dir\CID-DBCI-JOB1
simple  23-Sep-2014 15:39:07    Executing build CI-Demo-Tethys-RG - DB-CI - Default Job #27 (CID-DBCI-JOB1-27)
simple  23-Sep-2014 15:39:07    Running pre-build action: Clover Grails PreBuild Action
simple  23-Sep-2014 15:39:07    Running pre-build action: VCS Version Collector
command 23-Sep-2014 15:39:07    Substituting variable: ${bamboo.buildNumber} with 27
simple  23-Sep-2014 15:39:07    Starting task 'DB Test Case' of type 'com.atlassian.bamboo.plugin.dotnet:mstestRunner'
command 23-Sep-2014 15:39:07    Beginning to execute external process for build 'CI-Demo-Tethys-RG - DB-CI - Default Job #27 (CID-DBCI-JOB1-27)'\n ... running command line: \nC:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /testcontainer:D:\\Project\\UnitTestProjct\\RGTestingToolTestProject\\RGTestingToolTestProject\\bin\\Debug\\RGTestingToolTestProject.dll /resultsfile:testresults_27.trx\n ... in: C:\Users\neeraj.dubey\bamboo-home\xml-data\build-dir\CID-DBCI-JOB1\n
build   23-Sep-2014 15:39:07    Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
build   23-Sep-2014 15:39:07    Copyright (c) Microsoft Corporation. All rights reserved.
build   23-Sep-2014 15:39:07            
build   23-Sep-2014 15:39:07    Loading D:\\Project\\UnitTestProjct\\RGTestingToolTestProject\\RGTestingToolTestProject\\bin\\Debug\\RGTestingToolTestProject.dll...
build   23-Sep-2014 15:39:07    Starting execution...
build   23-Sep-2014 15:39:36    
build   23-Sep-2014 15:39:36    Results               Top Level Tests
build   23-Sep-2014 15:39:36    -------               ---------------
build   23-Sep-2014 15:39:36    Failed                RGTestingToolTestProject.RGDBUnitTestCase.GetTestResults
build   23-Sep-2014 15:39:38    0/1 test(s) Passed, 1 Failed
build   23-Sep-2014 15:39:38    
build   23-Sep-2014 15:39:38    Summary
build   23-Sep-2014 15:39:38    -------
build   23-Sep-2014 15:39:38    Test Run Failed.
build   23-Sep-2014 15:39:38      Failed  1
build   23-Sep-2014 15:39:38      ---------
build   23-Sep-2014 15:39:38      Total   1
build   23-Sep-2014 15:39:38    Results file:  C:\Users\neeraj.dubey\bamboo-home\xml-data\build-dir\CID-DBCI-JOB1\testresults_27.trx
build   23-Sep-2014 15:39:38    Test Settings: Default Test Settings
simple  23-Sep-2014 15:39:38    Parsing test results...
simple  23-Sep-2014 15:39:38    Failing task since 1 failing test cases were found.
simple  23-Sep-2014 15:39:38    Finished task 'DB Test Case'
simple  23-Sep-2014 15:39:38    Running post build plugin 'NCover Results Collector'
simple  23-Sep-2014 15:39:38    Running post build plugin 'Clover Results Collector'
simple  23-Sep-2014 15:39:38    Running post build plugin 'Artifact Copier'
simple  23-Sep-2014 15:39:38    Finalising the build...
simple  23-Sep-2014 15:39:38    Stopping timer.
simple  23-Sep-2014 15:39:38    Build CID-DBCI-JOB1-27 completed.
simple  23-Sep-2014 15:39:38    Running on server: post build plugin 'NCover Results Collector'
simple  23-Sep-2014 15:39:38    Running on server: post build plugin 'Clover Delta Calculator'
simple  23-Sep-2014 15:39:38    Running on server: post build plugin 'Build Hanging Detection Configuration'
simple  23-Sep-2014 15:39:38    Running on server: post build plugin 'Maven Dependencies Postprocessor'
simple  23-Sep-2014 15:39:38    All post build plugins have finished
simple  23-Sep-2014 15:39:38    Generating build results summary...
simple  23-Sep-2014 15:39:38    Saving build results to disk...
simple  23-Sep-2014 15:39:38    Indexing build results...
simple  23-Sep-2014 15:39:38    Finished building CID-DBCI-JOB1-27.

此致

Neeraj

2 个答案:

答案 0 :(得分:0)

您想要一个xml输出文件还是一个html文件? 如果是xml,则TRX文件已经是xml。 如果是html(报告),试试这个 - http://trx2html.codeplex.com/创建html以便在报告中使用。 如果您尝试删除解析结果步骤,则可以将mstestrunner包装在msbuild脚本中的Target中。在exec中,添加以下属性:

  IgnoreExitCode="true"
  ContinueOnError="true">
  <Output TaskParameter="ExitCode" PropertyName="msTest_CmdExitCode"/>

答案 1 :(得分:0)

有关您的环境的更多信息将是有益的,但是我以.NET Core为例。您可以指定-logger 选项和 LogFileName 的组合,以从.trx文件生成测试结果作为.xml。

请在下面查看我使用.NET CLI作为示例命令的位置

dotnet test "./src/YourProjects.Tests/YourProjects.Tests.csproj" --logger "trx;LogFileName=TestResults.xml"