Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run XUnit Tests with Jenkins

i have just started with XUnit and configuring Jenkins and i wanted to ask if there is a way to run XUnit Tests directly started by Jenkins and not with a windows batch command, that starts the console runner of XUnit.

I know there is the possibilty to run the XUnit tests by executing a Windows batch command via the Console Runner but im looking for a Plugin / whatever that for example includes the XUnit Runner and you only have to point to the dll so he starts the Tests and processes the XML output.

like image 286
Dominik Lemberger Avatar asked Feb 15 '16 09:02

Dominik Lemberger


People also ask

Is there a Jenkins plugin for executing xUnit tests?

No, there is not a Jenkins plugin for executing xUnit.net tests. The simplest way will be to run a Windows batch command within a Jenkins job. You can at least use the xUnit plugin to parse the test results XML file from xUnit.net and update the build outcome based on whether all tests passed or not.

How to run TestNG tests using Jenkins?

We have created a new project ‘ TestNGProject ‘ with the configuration to run TestNG Tests using Jenkins. You could see in the below screenshot. Let’s execute it now. Click on ‘ Build Now ‘ button. It will invoke testng.xml from the batch file. Right click on Build Number (here in my case it is #1) and click on Console Output to see the result.

Is it possible to run xUnit tests using Windows batch command?

I know there is the possibilty to run the XUnit tests by executing a Windows batch command via the Console Runner but im looking for a Plugin / whatever that for example includes the XUnit Runner and you only have to point to the dll so he starts the Tests and processes the XML output. Show activity on this post.

How do I run a DotNet core RC2 project in Jenkins?

In order to successfully run unit tests and code coverage analysis for a .NET Core RC2 project, you first have to install the .NET Core Preview 1 SDK. It is available at the official dot.net site and installs the dotnet CLI tool and registers it globally for all users on the PATH variable. In Jenkins, you'll need the following plugins:


1 Answers

You can make it work with xUnit Jenkins plugin.

1) Have xUnit plugin installed.
2) In your pipeline save an xml file with xUnit results (I used https://github.com/Faizan2304/LoggerExtensions to make it work with "dotnet test" command).
3) Publish results with this code:

step([$class: 'XUnitBuilder',
    thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
    tools: [[$class: 'XUnitDotNetTestType', pattern: '{path to your xml file}']]])
like image 54
Andrey Zakharov Avatar answered Oct 12 '22 09:10

Andrey Zakharov