Run NUnit tests from Jenkins
This blog walks you through setting Jenkins up for hooking Nunit tests.
Enable the MSTest plugin
- Once on the main page of Jenkin's you will need to navigate to Manage Jenkins in the left-hand navigation.
- Then click on Manage Plugins like below.
- Once on the main page of Jenkin's you will need to navigate to Manage Jenkins in the left-hand navigation.
- Then click on Manage Plugins like below.
- Then click on the Available tab.
- Check the MSTest checkbox under .NET Development.
- Scroll down and click on "Download now and install after restart".
Adding NUnit to project configuration
- In your project go to Configure > Build
- Add a build step
- In the dropdown scroll down to Execute Windows Batch Command
- Ensure this step is placed after your MSBuild step
- Add the following, replacing the variables with exact path to the files.
dotnet test [fullpath]\NUnitTestApplication.dll --logger "trx;LogFileName=TestResults.trx"
Adding Post Build Test results
- In your project go to Configure.
- Add post-build action > Publish MSTest test result report.
- You can leave everything else as is like below.
Report
You should now be able to see the results of your test like below
No comments:
Post a Comment