Integrate MsTest with MsBuild into Teamcity

If you choose to run Teamcity with a .sln you have an almost automatic integration into Teamcity that can be configured from the web interface.

For most stuff I end up needing a MsBuild Script to get all the Tasks done required for our Builds. If you choose MsBuild as a buildrunner in Teamcity you lose the nice GUI for configurating MsTest . So you need to run the tests by yourself with a simple target in an MsBuild script:

<Target Name=”MsTest”>

    <Exec IgnoreExitCode=”true” Command=”&quot;$(VS2008_Path)\mstest.exe&quot; /testcontainer:BridgeTest.dll  /resultsfile:BridgeTest.trx”  />

    <Message Text=”##teamcity[importData type='mstest' path='BridgeTest.trx']“/>

</Target>

The Trick  is the Second Task which serves as a Service Message and tells Teamcity to Import the results from MsTest.

Other versions of running MsTest from MsBuild can be found in my previous post.

Mostly the same applies for Nunit Tests – yet you don’t need the Service Message because Teamcity can import Nunit reports from the gui.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>