3

In order to automate unit tests on TeamCity I had to create a test list in my vsmdi configuration file indicating that every test is part of a list I called CompleteCoverage. I dislike this a lot because in order to auto-run new tests I'll have to remember to include them on this list.

Is there some way to run every test in the solution using TeamCity and MSBuild (other than explicitly referencing the path to the output test assembly)?

Should I just drop MSTest and go for NUnit?

bevacqua
  • 47,502
  • 56
  • 171
  • 285
  • what is the issue with just referencing your test assembly if you want to run all tests? – wal Mar 17 '12 at 07:00
  • the fact that depending on the configuration I have to specify different hardcoded locations `bin\Debug`, etc – bevacqua Mar 17 '12 at 08:32
  • `depending on the configuration` <-- ie Release vs Debug builds? If Yes, shouldnt these be separate builds (configuration) in teamcity? – wal Mar 17 '12 at 10:31
  • The locations shouldn't need to be hardcoded if you use the Configuration property (ie. "Path\To\Project\bin\$(Configuration)\TestAssemblyName.dll"). – Bilal Mar 22 '12 at 00:54

1 Answers1

3

I'm using NUnit instead of MSTest, but this should work for you, too:

I've named all my test assemblies to include .NUnit in their name, e.g. Basic.NUnit.dll. In the build step performing the tests, I've declared **/*.NUnit.dll as the assemblies to run. To make sure that they are run in the right location, I've added **/obj/**/*.NUnit.dll to the exclude list. Together with test categories to in- or exclude, I've got perfect control over which tests to run on a purely declarative level without to name the individual tests.

freefall
  • 350
  • 1
  • 3
  • 7