Friday, July 29, 2016

Running Visual Studio Unit Tests in TeamCity

As I start writing Unit Tests for my application, I usually also want to ensure that all of my Unit Tests are also passing whenever I check in my code!

The easiest way to accomplish this is to integrate the execution of my Unit Tests within TeamCity is to add a "Visual Studio Tests" build step:



Once you add the Visual Studio Tests Build Step, you will need to add the paths to the Unit Test assemblies.  I usually like to create TeamCity parameters and then pass the list of Unit Test assemblies to the Visual Studio Tests Build Step.



However, even though it is stated in the TeamCity User Interface and documentation that you can pass multiple Unit Test assemblies by including each path on a separate line, this has been quite unreliable since in a long list of Unit Test assemblies, any problems are not reported if those Unit Test assemblies are missing!  Therefore, I prefer to create separate Build Steps for each of my Unit Test assemblies to ensure I am able to see any errors that occur with any of my Unit Tests:





That is all there is to it!!

No comments:

Post a Comment