Continuous deployment
.NET Core CICD Continuous Deployment Continuous Integration DevOps GitHub NUnit TeamCity Visual Studio

How to Configure a Build Pipeline for .NET Core Unit Test Projects within TeamCity

Welcome to today’s post.

In a previous post I showed how to create a build configuration within TeamCity for an existing .NET Core Application within a GitHub source repository.

In today’s post, I will show how to add NUnit tests into the build tasks for a full build, test and release pipeline with the TeamCity Continuous Integration / Continuous Deployment Tool.

The process is depicted in the diagram below:

Team city unit test

The current version I am using for this post is Team City 2018 (there has since been a 2019 release).

Open TeamCity (the URL might be something like http://localhost:8080).  

In the landing page, click on the Projects menu item.

In the projects page, click on Build under the project:

Click on Edit Configuration Settings in the Build page:

Click on Add build step.

In the next screen, a test step can be created as shown:

After saving the step and reordering the test step before the publish step. the list of build steps looks as follows:

After running the build, open the logs to inspect progress.

Expanding the unit test step will show each successive test as it is run:

Under Agents | Build History or Projects | Build are the test reports which show which test build passed and which ones failed:

Drilling into the most recent test run will show a conclusion of each test run and duration:

Click on all tests will show a detailed summary including status and duration:

That’s all for today’s post.

I hope you found it useful and informative.

In a future post I will show how to deploy your application build from Team City into a production environment.

Social media & sharing icons powered by UltimatelySocial