Jenkins xUnit test result report
Asked Answered
S

1

12

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?

Shambles answered 26/1, 2016 at 19:52 Comment(4)
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?Protist
@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.Shambles
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.Fp
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'.Incandesce
M
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.

Mesial answered 18/10, 2017 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.