0

I need to parse MS Testresult into xml format from .trx in Bamboo build.

For that i have add a task MS test parser and execute the manual run in bamboo,but i don't know i to get result in XML.

Please suggests how to do same.

Here is the log of build

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.

Regards

Neeraj

Neeraj Dubey
  • 4,401
  • 8
  • 30
  • 49

2 Answers2

0

Do you want an xml output file or an html file? if xml, the TRX file is already xml. if html (report), try this - http://trx2html.codeplex.com/ creates html for use in reports. if you are trying to remove the parse results step, you can wrap the mstestrunner in a Target in a msbuild script. In the exec, add the following attributes:

  IgnoreExitCode="true"
  ContinueOnError="true">
  <Output TaskParameter="ExitCode" PropertyName="msTest_CmdExitCode"/>
boxkita
  • 36
  • 3
0

More information about your environment would be beneficial, but I am taking an example of .NET Core. You can specify combination of --logger option and LogFileName to generate test results as .xml from .trx file.

Please see below where I am using .NET CLI as an example command

dotnet test "./src/YourProjects.Tests/YourProjects.Tests.csproj" --logger "trx;LogFileName=TestResults.xml"
ekhanna
  • 800
  • 8
  • 12