How do I see test results in TeamCity?

xUnit.net 1.1 added support for JetBrains' TeamCity. This support is automatically enabled, and requires no end-user configuration.

You must use an external build runner (like MSBuild) when building your project in TeamCity, so that you can add calls to either the MSBuild task or the console runner. You cannot use TeamCity's SLN builder, because your SLN file does not have any references to running xUnit.net (and TeamCity does not understand xUnit.net tests natively).

Both the MSBuild task and the console runner support TeamCity, and detect TeamCity is running through environment variables (specifically, it looks for TEAMCITY_PROJECT_NAME). If for some reason your build environment does not pass the TeamCity environment variables through to the runner, you can force TeamCity mode manually; on the console runner, add the /teamcity switch; on the MSBuild runner, add the property TeamCity="true" to your xunit task.

For more information on using MSBuild, see How do I Run Tests From MSBuild?.

Requirements

  • TeamCity 3.1 or later
  • Use xunit.console.exe or xunit.runner.msbuild.dll to run your tests
  • Ensure you are using v1.1 or later of the xUnit.net runner exe/dll
  • Ensure your tests are linked against v1.1 or later of xunit.dll

Last edited Apr 29, 2009 at 9:16 PM by BradWilson, version 4