How to run xUnit tests on Jenkins

Jenkins does not support running of xUnit tests out of the box. So that you need to run it manually and import test results to Jenkins. This quick manual shows how to do this.

  1. 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.
  2. Install “xUnit Plugin” to your Jenkins. This plugin will be used to import tests results to Jenkins.
  3. (Optional) Install “Test Results Analyzer Plugin” to your Jenkins. It will show cool summary about tests.
  4. Add “Execute Windows batch command” as a step to your Jenkins job.

    <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.
  5. 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.

  1. Add variable to xunit console to use shortcut in commands
  2. Write power shell script to automaticaly pick all DLLs with tests

See Also

http://thecache.trov.com/integrating-xunit-v2-with-jenkins/

 




No Comments


You can leave the first : )



Leave a Reply