Jenkins - failed: No test report files were found. Configuration error?

65,217

Solution 1

You can also enable the 'allowEmptyResults' option so that the junit plugin won't throw an exception when it doesn't find test results.

This way it doesn't matter if the 'test-results' directory exists.

junit allowEmptyResults: true, testResults: '**/test-results/*.xml'

Solution 2

First make sure junit.xml is getting generated after the test run.

Jenkins job at times cannot see past the current workspace. so it is always a good idea to copy the reports back to the current workspace before using it.

    cd <path to report>
    cp *.xml $WORKSPACE

Now the jenkins should pick-up the report. Note: The config may show error first(since it cannot find the xml file in workspace) but after a build this should go away and also the result should get recorded

Solution 3

I'm using nosetest (python) to generate an xUnit compatible file and I was getting:

ERROR: No test report files were found. Configuration error?

I was using junit plugin as:

junit "test-results-unit.xml"

junit seems to add WORKSPACE directory by default so using the full PATH to the file wouldn't work either. I created symlink from the resulting file to the WORKSPACE directory to make it work:

  sh 'ln -s tests/test-results-unit.xml $WORKSPACE'
  junit "test-results-unit.xml"

Solution 4

Other answers suggest copying the files to the workspace directory, but for me simply changing the path to start with '**' seemed to solve the issue

junit '**/test-reports/*.xml'

The Jenkins junit plugin page says that you need to "specify the path to JUnit XML files in the Ant glob syntax". I've not dug into the full details of what this means, but starting the path with '**' was enough to get it working for me.

Solution 5

Thanks @Acid, it really helped me. First, copy the module/build/test-results to workspace directory

cp -r app/build/test-results $WORKSPACE/test-results

And then I used this wildcard path

**/test-results/**/*.xml
Share:
65,217
iPatel
Author by

iPatel

Download my own game: MorUde Frrr - (Fly Or Not) iOS: https://apps.apple.com/us/app/morude-frrr-fly-or-not/id1482474790 Android: https://play.google.com/store/apps/details?id=com.flyornot.morude TwO Fundamental Of "Cool Life" 1) "WalK, LiKe U R The KinG" oR 2) "WalK LiKe U Don'T CaRE, WhO Is ThE KiNg" #SOreadytohelp Listed under top 100 users from India.

Updated on September 02, 2021

Comments

  • iPatel
    iPatel over 2 years

    I'm beginner for "Jenkins" and following this tutorial.

    At the Sixth step I got below error.

    xcodebuild: error: Scheme JenkinsTest is not currently configured for the test action.

    Build step 'Xcode' marked build as failure Recording test results ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error? Finished: FAILURE

    In the Test report XMLs I did set "test-reports/.*xml"

    I tried to find my solution and also many questions are founded on SO like same issue I have too but did not get solution.

    I have some confusion, Is .xml file automatically generated by "Jenkins" or First we manually need to add .xml file ?

    In short guide me on right direction based on above error.

  • Ashish Karpe
    Ashish Karpe almost 7 years
    I am on aws linux instance # junit MobaXterm X11 proxy: Unsupported authorisation protocol Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:11.0' as the value of the DISPLAY variable.
  • gregdferrell
    gregdferrell almost 6 years
    I was having the same issue and copying the xml file to the root of the workspace resolved it for me. I had been running "junit <path-to-file>" instead, which wasn't working. I do not understand why this fixes it, however. Can you explain this statement more: "Jenkins job at times cannot see past the current workspace. so it is always a good idea to copy the reports back to the current workspace before using it."
  • Gaurav Parek
    Gaurav Parek over 2 years
    I am also getting same error, tried the approach suggested by you but no luck. Could you please advise if any other changes I need to make
  • Joaquin684
    Joaquin684 over 2 years
    @GauravParek try finding the test-results-unit.xml file first by running ls or find, then create the symlink to the correct path