Publishing MSTEST test results to TFS2010

Hi there,

I write tests in Visual Studio 2010 using Typemock Isolator. My problem is that the MSTest action doesn't really work with my Typemock Isolator tests. What does work is start TMockRunner.exe from Typemock, have that tool run MSTest.exe and execute the tests. That what I did in the past and it worked quite well.

We're now planning to upgrade to FinalBuilder 7, as we've installed TFS2010 and would really like to have our test results in the TFS2010 build log. This works great with normal MSTest.

Question is, how can I publish the MSTest.exe testresults (the .trx file) into the TFS2010 buildlog when the MSTest action (from FinalBuilder7) doesn't publish the result itself?

Thanks in advance

Hi Dennis,
The MSTest action <i>should</i> be publishing results to TFS, so long as you set it up on the Publish Results tab of the action. However, that won’t help you publish a pre-existing .trx.

I haven’t used Isolator - when it calls MSTest does it allow you any control? If so, you can pass the ‘publish’ paramaters to MSTest, and it will publish to TFS for you. FinalBuilder uses the following command line for MSTest, which should give you an idea:

[code]/testcontainer:"C:\path\to\dll\SimpleLibraryTest.dll" /resultsfile:C:\path\to\temp\file\results.trx /nologo /publish:http://localhost:8080/tfs/DefaultCollection /teamproject:FBWorkflow /publishbuild:"SimpleLibrary - FB7_20100909.4" /flavor:Debug /platform:"Any CPU" [/code]

If Isolator doesn’t allow you to control MSTest, you can use an Execute Program action in FinalBuilder to run MSTest in ‘upload only’ mode. From Microsoft Learn: Build skills that open doors in your career

<blockquote>To publish test results from a previous test run

Use a command line that includes options that specify how to publish the test run. Options that are required for publishing are /publish, /publishbuild, /teamproject/, /platform, and /flavor.
Use the /publishresultsfile option to specify the name of the results file to publish. This is a file that has the .trx extension.
For more information, see Command-Line Options for Publishing Test Results.
The test data for the runs you selected is published to the operational store. </blockquote>

Hope that helps,

Ben

Thanks a lot, Ben!!!

I now use an “Execute Program” activity. I set the program file to:
[code]C:\Program Files (x86)\Typemock\Isolator\6.0\TMockRunner.exe[/code]
The execute parameters I set to:
[code]“C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe” /testcontainer:"%SourceRoot%\Binaries\MyTestAssembly.dll" /resultsfile:"%TEMP%%BuildId%.trx" /publish:%TeamServer% /teamproject:%TeamProject% /publishbuild:"%BuildId%" /flavor:%BuildFlavor% /platform:"%BuildPlatform%"[/code]

And it works like a charm!

You can add multiple test containers if you’d like, like this:
[code]/testcontainer:"%SourceRoot%\Binaries\MyFirstTestAssembly.dll" /testcontainer:"%SourceRoot%\Binaries\MySecondTestAssembly.dll" [/code]

Glad that helped - thanks for sharing your solution.

Ben