- Add xunit console runner to your test projects. You should add the package “xunit.runner.console” from NuGet and you’re done. You will use it to run your tests.
- Install “xUnit Plugin” to your Jenkins. This plugin will be used to import tests results to Jenkins.
- (Optional) Install “Test Results Analyzer Plugin” to your Jenkins. It will show cool summary about tests.
- Add “Execute Windows batch command” as a step to your Jenkins job.
<xunit-runner-path>\xunit.console [list-of-dll] -xml <xunit-testresults-path>\yourproject-xunit-results.xml
<unit-runner-path> – the folder containing the file xunit.console.exe. It should be located in the “packages” folder of your project somewhere at location “<project_root>\packages\xunit.runner.console.2.2.0\tools\”
<xunit-testresults-path> – some folder where you’d like to store the file with results. It might be the root project folder.
- Add Post-build Action “Publish xUnit test result report” and choose “xUnit.Net-v2 (default)”: **/yourproject-xunit-results.xml
At this point you should be able to see results of tests in Jenkins. You can make other modifications to improve Jenkins configuration.
- Add variable to xunit console to use shortcut in commands
- Write power shell script to automaticaly pick all DLLs with tests