How to Integrate .NET Projects with Jenkins

Hi all, in this article, I will explain how to integrate Jenkins,TFS, NUnit, OpenCover, Cobertura,CatLight, JIRA, and Slack with each other. I tried to prepare this article to cover all details and I hope, it will help you for your continuous integrationprocess.

Tool Belt

We will use below tools for separate purposes.

Jenkins– It is our CI server. Orchestration will be done with Jenkins.

NUnit– It is our test runner framework. We wrote our tests by using NUnit.

OpenCover– It is our test coverage tool and it is open-source.

ReportGenerator– It generates HTML reports by using .xml files.

OpenCoverToCoberturaConverter– It converts OpenCover results to Cobertura format. It creates more fancy and stylish reports. You need to build it and generate an executable. I generated one and you can download it here (version 2.0.4).

CatLight– It is a desktop build notifier and located at the system tray.

JIRA– It is our issue tracking and agile management tool.

Slack– It is our internal messaging application.

Jenkins CI Flow

Build Actions

  • Trigger Jenkins and start to run Jenkins Job.
  • Connect the TFS and pull the project into a local folder which is located in CI server. Then, build the latest release withMSBuild.
  • Start to run NUnit Unit Tests and execute code coverage with OpenCover.
  • Convert OpenCover results to Cobertura Coverage Results.

Post-Build Actions

  • Publish CoberturaHTML Coverage Report
  • Publish OpenCoverHTML Report
  • Publish NUnitTest Results
  • Update relevant JIRAIssues
  • Create JIRAIssue If the build fails.
  • Send an emailif the Jenkins job is not successful.
  • Send build notifications to the related Slack
  • If everything pass, we will to a deployment to the test environment with Octopus Deploy.
  • Run automated Selenium Tests.

Step by Step Explanation

1) Install Jenkins on server

Install latest version of Jenkinsfrom https://jenkins.io/. We use Windows Server 2012 so I installed windows version. You can find the instructions here.

2) Install Plugins

Install below pluginsfor Jenkins.

How to Install Jenkins Plugins?

Open Jenkins then go to “Manage Jenkins” –> “Manage Plugins

Then, click “Available” tab and then write the desired plugin name into the search box. After that, the related plugin will appear. Select the plugin and click Install button. In these way, you can install all Jenkins Plugins.

— To be continued —

Please follow and like us:

Leave a Reply