1

I'm calling MSTest like this:

<Target Name='UnitTests'>
    <CallTarget Targets="BeforeUnitTests" />
        <Exec Command='"$(VS90COMNTOOLS)..\IDE\mstest.exe"  /testmetadata:$(SourceCodeRootFolder)ASA.File.Processing.vsmdi  /testlist:buildtests' />
    <CallTarget Targets="AfterUnitTests" />
</Target>

It's running, but whether it succeeds or fails, no errors are written to the MSBuild error file. I'm running MSBuild with these parms:

/fl /flp:v=detailed;logfile=Errors.txt;errorsonly 

I have emails set up to email our team if there are errors in the Errors.txt file.

VK Macwana
  • 21
  • 3

1 Answers1

0

Unless the MSTest program itself fails, you won't get errors in the MSBuild logfile, at least from the test portion of your build stream.

One of the MSTest options is to publish the results to TFS; you should be able to use standard notification setup there to let your teammates know what happened. Or you could use the resultfile parameter in the MSTest call and parse/publish based on what you find in the file.

We use Codeplex project Trx2Html to publish the results to an internal website that everyone has access to.

DaveE
  • 3,579
  • 28
  • 31
  • DaveE - Unfortunately we are not using TFS., is there any other option inside Build utility from where we can capture the error ? – VK Macwana Jan 25 '12 at 13:26
  • You can use the `resultfile` to capture the test output and parse that. It's straight XML. From your description, you're only interested in errors, so you'd be looking for `` elements where attribute `outcome` is "Failed". `testName` is an attribute of ``, so you should be able to tell your devs exactly what test failed. There are other elements - `` and `` - under `` that you can post in the email as well. – DaveE Jan 25 '12 at 18:00