What type of Runner and other settings should I choose to run unit tests in Team City?

I installed TeamCity for CI on one of our servers and managed to get it to work to the point where, if someone makes transactions in SVN, TeamCity picks up the changes and builds the code at the end.

Now I'm trying to add our Unit Test project to TeamCity so that we also find out if any test passed when we pass the code.

We have a test project (named TeamTest ) and all Unit Tests are written in it, now when I try to add this project as a Build Step to TeamCity , what Runner Type should I choose?

Do I need to install some other software on my build server in order to make it work?

Which way should I enter in Run tests from if the runner type is selected as NUnit or MSTest ? (This is the TeamTest project DLL )

I apologize if this is a stupid question, but I tried to find the Internet by asking for TeamCity blogs, but I can not find the answer to my question.

+6
source share
1 answer

The type of runner you require for your unit test project is entirely dependent on what kind of testing framework they are written for.

If they are written for NUnit, you will choose the type of runner NUnit, for MSTest you will choose this runner.

As for the installation, you simply include the output of your test project libraries in the list of builds. Remember that you can use wildcards in this form, so if you had several unit test projects with a specific naming scheme, you can include them all simply by using the following:

 **\*Tests.dll 

This will include all files with the name * something * Tests.dll in all folders. You can, of course, hard-code your individual case, as an example that might look like the following:

 TeamTests\bin\Release\TeamTest.dll 

In my experience, the rest of the options can be left as default. Then TeamCity runs all the tests that it finds in the found assemblies, and automatically refuses the assembly with one test failure.

Regarding external software; if you run tests with the MSTest runner, the build server needs the MSTest binaries available for it. The easiest way to achieve this is to install Visual Studio on the build server, but if you don't need additional bloating, you can follow these steps here to install MSTest without Visual Studio.

If you have chosen NUnit as the basis for testing, no external software is required, as NUnit comes with TeamCity.

+11
source

All Articles