【问题标题】:Publish MS Test result in XML in Bamboo Build server在 Bamboo Build 服务器中以 XML 格式发布 MS 测试结果
【发布时间】:2019-01-24 03:48:30
【问题描述】:

我需要在 Bamboo 构建中将 MS Testresult 从 .trx 解析为 xml 格式。

为此,我添加了一个任务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.

问候

尼拉杰

【问题讨论】:

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


    【解决方案1】:

    你想要一个 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"/>
    

    【讨论】:

      【解决方案2】:

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

      请参阅下面我使用 .NET CLI 作为示例命令的地方

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

      【讨论】:

        猜你喜欢
        • 2016-02-18
        • 1970-01-01
        • 2017-02-26
        • 2011-10-19
        • 1970-01-01
        • 2016-01-13
        • 1970-01-01
        • 2019-02-06
        • 2014-06-11
        相关资源
        最近更新 更多