How do I run MSTest as part of my build process in TeamCity? What are the pitfalls?
相关问题
- Resharper 7 on VS2012 ignores assembly redirect in
- Export test results from Test Explorer visual stud
- Gallio error : MSTest executable was not found
- FSharp project build fails in MSBuild in TeamCity
- TeamCity's git checkout different from local g
相关文章
- Log4Net Multiple Projects
- Attribute filter syntax for code coverage in TeamC
- TeamCity Username / password
- How to replace Middleware in integration tests pro
- How do I make a TeamCity build appear in the TFS B
- Is it possible to specify when a Build Feature is
- How to run ClassCleanup (MSTest) after each class
- TeamCity: Prevent 2 builds from running simultaneo
This answer is specifically for TeamCity 7.1 on Windows, but may apply to other environments.
Artifacts\MSTest => MSTest
if not exist Artifacts\MSTest mkdir Artifacts\MSTest
**\bin\**\*.Tests.dll
Artifacts\MSTest\testResults.trx
Pitfalls
Using wildcards when specifying which test assemblies to run
You can use wildcards when specifying which test assemblies to run in the MSTest build step, although it is unclear exactly how they work. A bug report has been filed.
The build process doesn't stop when tests fail
Be aware that if some of your tests fail and the build is marked as failed, the MSTest build step itself does not fail. This causes problems if you have build steps after the MSTest build step which you don't want to run if you have test failures (e.g. it may not make sense to produce an installer or documentation of a build you know has bugs). The problem will hopefully be fixed in later versions of TeamCity.
If you want your build process to stop when you have test failures, you can create a new build step that uses the TeamCity REST API to detect if the current build has been marked as failed (remember that when tests fail, the build step is not marked as failed, but the build is), and then fail the current build step explicitly. Example:
Script: