First - added a build action: run unit tests with VSTest.console
Second - added a build-action: Execute Windows batch command to convert the 
results from vstest to junit
Third - added a post-build action: Publish JUnit test result report

What VSTest.console outputs is XML, what the JUnit report publisher expects 
is XML. But the schemas differ, and the filenames are different.

The mstest-to-junit.xsl file, attached 
to https://issues.jenkins-ci.org/browse/JENKINS-19360 is an XSL 
transform,which will convert the an XML file from the VSTest.console schema 
to the Junit schema. But how to run it from Jenkins?

I installed Saxonica's xslt tools on the build 
machine: http://www.saxonica.com/welcome/welcome.xml

I created a directory in Jenkins_home for my own custom stuff, and in that 
directory I placed the mstest-to-junit.xsl file, and a batch file:

@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"


Part of the problem is that VSTest.console outputs into a time-stamped 
filename. The batchfile is wildcarded, and will convert any .trx file into 
"testresults.xml".

The batch command, in Jenkins:

ECHO Convert VSTest.console output to JUnit format

CD %WORKSPACE%

%JENKINS_HOME%\MyStuff\ConvertVsTest2Junit.bat %WORKSPACE%\TestResults








On Wednesday, November 5, 2014 2:08:15 PM UTC-6, Rob D wrote:
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to