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
--
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-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@ECHO OFF
SET "WORKINGDIR=%~1"
FOR %%t IN ("%WORKINGDIR%\*.trx") DO ( "d:\Program Files\Saxonica\SaxonHE9.5N\bin\Transform.exe" "-s:%%t" "-xsl:%JENKINS_HOME%\KorTerraStuff\mstest-junit.xsl" -versionmsg:off "-o:%WORKINGDIR%\testresults.xml")
DEL "%WORKINGDIR%\*.trx"
ECHO Convert VSTest.console output to JUnit format
CD %WORKSPACE%
%JENKINS_HOME%\MyStuff\ConvertVsTest2Junit.bat %WORKSPACE%\TestResults