10

I have a Jenkins job to copy some test reports(XML) to local and convert them to JUnit reports via xUnit.

The issue is that there are no failed or skipped tests, but I always get

    [xUnit] [INFO] - Check 'Failed Tests' threshold.
    [xUnit] [INFO] - Check 'Skipped Tests' threshold.
    [xUnit] [INFO] - Setting the build status to FAILURE
    [xUnit] [INFO] - Stopping recording.
    Finished: FAILURE

What causes this?

Jay Cui
  • 117
  • 1
  • 8
  • Are there any test results? The xUnit publisher may be configured to fail if there are no results. Is this the only xUnit output in your build? What is the build configuration? What version of the xUnit plugin do you have? – Dave Bacher Jan 26 '16 at 23:13
  • @Dave Bacher This is the weird part. I do have test results and it is pretty large set of files. After I get those xml reports, I try to use xUnit to publish them. That Jenkins job works correctly before, but just stared to fail recently. I have no idea what happened. – Jay Cui Jan 27 '16 at 23:39
  • 3
    I had this same issue, I was triggering the running of my unit tests (and the creation of the xml result files) via a Bash script, the script was returning `1` and **this** was causing the build to fail, the line `[xUnit] [INFO] - Setting the build status to FAILURE` was misleading because it wasn't setting the build to failure, the build was **already** set to failure by the return code of my script. I believe it is simply mirroring the current state of the build. – Troyseph Mar 01 '16 at 16:33
  • same thing to me, I have 3 more lines before your output. They are `[xUnit] [INFO] - Starting to record. [xUnit] [INFO] - Processing JUnit [xUnit] [INFO] - [JUnit] - 1 test report file(s) were found with the pattern 'nosetests.xml' relative to '/home/jenkins/workspace/mts-pipeline-quality' for the testing framework 'JUnit'.` – Henry Apr 07 '17 at 14:06

1 Answers1

0

On my previous project I was running 3 development teams with 4 solutions that together consisted an integrated platform all on one Jenkins Master.

I had 2 DOS batch files that were held in a JenkinsScripts/ subdirectory at the root of each solution. One was called CodeCoverage.bat (which ensured OpenCover and ReportGenerator watched the unit tests) which in turn called RunUnitTests.bat passing parameters.

In RunUnitTests.bat the key line with many parameters resolved to:

packages\xunit.runner.console.2.1.0\tools\xunit.console.exe <MyUnitTestProject.dll> -nologo -noshadow -nunit TestReports\TestResults.xml

Hence, I was converting XUnit result XML to NUnit result XML and using the NUnit Plugin to publish the results.

Since I used this approach, the options for mapping of XUnit and NUnit 3 XML to Jenkins friendly JUnit (at my behest mind you) has improved.

Andrew Gray
  • 3,190
  • 2
  • 29
  • 55