Hi!

I’ve found two incompatibilities between the publish functionality of the 
mstest plugin and vstest.console generated trx files:

1.       Vstest.console generates the name of the trx file dynamically

2.       Mstest plugin tries to parse fully qualified type names in the trx, 
where vstest.console writes simple names.

I ‘ve wrote a simple powershell script to translate the test result:

# Convert vstest.console generated trx files to be compatible with jenkins 
mstest extension
# (needs a comma in className)

if(Test-Path "${env:WORKSPACE}\TestResults\")
{
  $trxPath = Get-Item "${env:WORKSPACE}\TestResults\*.trx" | Select-Object 
-Last 1;

  [System.Xml.XmlDocument] $xmlDoc = new-object System.Xml.XmlDocument
  $xmlDoc.Load($trxPath)

  $nsmgr = New-Object System.Xml.XmlNamespaceManager $xmlDoc.NameTable
  $nsmgr.AddNamespace("t", 
"http://microsoft.com/schemas/VisualStudio/TeamTest/2010";)

  $testMethodList = 
$xmlDoc.SelectNodes("//t:TestMethod[not(contains(@className, ','))]", $nsmgr)

  foreach($testMethod in $testMethodList)
  {
    ($testMethod.Attributes.ItemOf("className")).Value += ","
  }

  $xmlDoc.Save("${env:WORKSPACE}\testresult.trx")
}

After running this this script the mstest plugin can be configured to search 
“testresult.trx”

I hope I could help.

Marci



From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Rob D
Sent: 2014. november 5. 21:08
To: jenkinsci-users@googlegroups.com
Subject: Re: Publishing vstest results?

Jeff, did you get this working. I just ran into the same issue and discovered 
your thread. I am very new to Jenkins so if you or anyone else can explain how 
to display the results of the vstestrunner plugin so that a beginner can 
understand it, I would be extremely grateful.

Rob

On Thursday, July 10, 2014 9:07:29 AM UTC-5, Glenn V wrote:
The xslt does not transform to MsTest format, but to JUnit format. You can 
import the resulting xml file with the "publish junit test result report" post 
build task.

Kind regards,
Glenn

On Monday, June 23, 2014 8:55:27 PM UTC+2, Jeff Dege wrote:
OK, I have added a Windows Batch Command task, that's using Saxonica's XLST 
transform to the VsTest .trx file to what is supposed to be an MsTest .trx file 
that the Jenkins plug-in can handle, using the .xsl file included in 
Jenkins-19360.

It's not working at all.

Where the untransformed file would display the passed and failed tests, but 
broke when you tried to display the results of a test, the plugin parses the 
transformed file and reports no tests at all.

I can't have been the first to deal with this.  Is there someplace else on the 
net I should be asking for help?

On Thursday, June 19, 2014 4:19:55 PM UTC-5, Jeff Dege wrote:
I have a VS2013 project that I'm building with Jenkins. Now I'm trying to get 
running the unit tests to be a part of the build process.

I'm running the tests with the VSTest Runner plugin, and that's working fine. 
But I've not figured out how to publish the results.

Currently, I'm trying the MSTest plugin, but it's only sorta working.

I have the VSTest Runner configured to log results to a trx file, and the file 
shows up in the TestResults directory of the Jenkins workspace, with a 
complicated, unpredictable name.

And I have the MSTest plugin configured to look for TestResults\*.trx - which 
I'm hoping will work for locating the file that the runner generated.

When I look at a build's Test Result, I a red/blue failure/success bar (8 
failures, 66 tests). And I see two grids below. The first is labeled "All 
Failed Tests", and has a row for each failed test. The second is labeled "All 
Tests", and has only one row, with a package of "(root)".

When I try to expand any of the failed tests, (clicking on the blue '+'), the 
row expands to show a pane displaying "HTTP ERROR 404".

So, the questions:


  1.  Does the MSTest plugin support vstest.console.exe's trx output?
  2.  If so, why am I only getting partial results?
  3.  Is it because I'm not passing the filename correctly?
  4.  If I'm not, how should I pass the filename between the two plugins?
  5.  And if the MSTest plugin does not support vstest.console.exe's trx 
output, what do I do?
  6.  Is there some other plugin I should be using? Some other tool?
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to