Out of the box, there are two options to configure MSTest 2008 webtests with TeamCity 4.0 build server. The first option is to add webtest names to the MSTest assemblies list. The second option is to specify MSTest configuration and .vsmdi metadata files. In both cases, TeamCity 4.0 does not fail a project build when webtests fail. Nor does TeamCity display webtests results as it does for unit tests.
To solve this issue, we created a custom command-line file to execute MSTest webtests:
set ConfigPath=<Path to your webtest configuration and .vsmdi files>
set ResultPath=<Path to .trx and .txt result files>
set MSTestPath=<Path to your MSTest.exe>
"%MSTestPath%\MSTest.exe" /runconfig:%ConfigPath%/Your.testrunconfig
/testmetadata:%ConfigPath%/Your.vsmdi
/resultsfile:%ResultPath%\Your%1.trx >> %ResultPath%\Your%1.txt
if not %errorlevel% == 0 exit 1
This file takes a build number as the first positional parameter, executes webtests listed in Your.vsmdi, and saves .trx result file as well as the execution summary report so that TeamCity could store them as build artifacts. We then configured a dependent build configuration to run this command-line file as part of our build process.
Happy coding!