3
votes

I have a jenkins standalone job, that uses the MSTest plugin, it publishes the test result (.trx) on the jenkins UI. I want to use this feature of the plugin via the workflow script. How can i achieve this?

At the moment, i am using this batch file, but it need the extra utilities like the "msxls.exe" which doesn't comes with cloudbees jenkins out of the box.

stage name: 'Publish test result', concurrency: 1
 bat 'C:\\bin\\msxsl.exe TestResult.trx "C:\\Jenkins\\plugins\\mstest\\WEB-INF\\mstest-to-junit_withOutput.xsl" -o JUnitLikeResultsOutputFile1.xml'
 step([$class: 'JUnitResultArchiver', allowEmptyResults: true, testResults: 'JUnitLikeResultsOutputFile1.xml'])
1

1 Answers

2
votes

If a plugin is compatible with the Pipeline plugin, then you can find out the appropriate Groovy DSL for it by enabling the "Snippet generator", choosing "step" and finding the desired build step in the "Build step" list.

It would look somewhat similar to the JUnitResultArchiver step you're already using.

However, unfortunately, the MSTest Plugin is not currently compatible with the Pipeline plugin, so it's not available in this list.

You would have to file a feature request to get this implemented.
The Pipeline plugin documentation also has some documentation for developers on how to make plugins compatible.