Michael Stephenson

Microsoft BPM/SOA Adventures
posts - 202, comments - 197, trackbacks - 15

My Links

News

View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn

Archives

Post Categories

Image Galleries

BizTalk

Mates

Calling MsTest from MsBuild with multiple test containers

Learnt something new with MsTest today… in the scripts I have for our projects we run the tests using MsTest from the command line as follows:

 

<Exec Command='"$(VS80COMNTOOLS)..\IDE\mstest.exe" /testcontainer:Acme\Group\BizTalk\Utilities\Tests\bin\$(ConfigurationName)\Acme.Group.BizTalk.Utilities.Tests.dll /runconfig:localtestrun.testrunconfig' />

 

<Exec Command='"$(VS80COMNTOOLS)..\IDE\mstest.exe" /testcontainer:Acme\Group\BizTalk\PipelineComponents\Tests\bin\$(ConfigurationName)\Acme.Group.BizTalk.PipelineComponents.Tests.dll /runconfig:localtestrun.testrunconfig' />

 

<Exec Command='"$(VS80COMNTOOLS)..\IDE\mstest.exe" /testcontainer:Acme\Group\BizTalk\Build\Tests\bin\$(ConfigurationName)\Acme.Group.BizTalk.Build.Tests.dll /runconfig:localtestrun.testrunconfig' />

 

<Exec Command='"$(VS80COMNTOOLS)..\IDE\mstest.exe" /testcontainer:Acme\Group\BizTalk\Testing\Tests\bin\$(ConfigurationName)\Acme.Group.BizTalk.Testing.Tests.dll /runconfig:localtestrun.testrunconfig' />

 

This will run out 4 test assemblies fine.  Ok so now I was interested in the code coverage aspect and getting the report into CruiseControl (more on this later) and I found a couple of things. 

 

1.             Each assembly is run completely seperately in different folders when it is tested

 

2.             There are 4 coverage reports, 1 for each assembly

 

This is really what you would expect, but in order to run the tests and get just one coverage file I needed to change the way I was calling MsTest.  Basically thanks to my collegue Callum Hibbert (who I always ask if I have a problem with anything Build or TFS related) I found that when calling MsTest you can specify multiple test containers an example of which would be as follows:

 

 <Exec Command='"$(VS80COMNTOOLS)..\IDE\mstest.exe" /testcontainer:Acme\Group\BizTalk\Utilities\Tests\bin\$(ConfigurationName)\Acme.Group.BizTalk.Utilities.Tests.dll /testcontainer:Acme\Group\BizTalk\PipelineComponents\Tests\bin\$(ConfigurationName)\Acme.Group.BizTalk.PipelineComponents.Tests.dll /runconfig:localtestrun.testrunconfig' />

 

(ive only specified 2 here to keep the example simpler but you can supply 4 in the same way)

 

This means when I now run the reports I have 1 folder containing all of the test stuff and also 1 test coverage file.

[As a side note on this we done have Team Suite or Team Test to use a test list]

 

Print | posted on Friday, April 27, 2007 10:13 AM | Filed Under [ BizTalk .net 2 MsBuild ]

Feedback

Gravatar

# re: Calling MsTest from MsBuild with multiple test containers

FYI, you might be better off using DevEnvDir rather than $(VS80COMNTOOLS). For me it is set to:

DevEnvDir=c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
11/14/2008 2:17 AM | Justin CHase
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: