36
votes

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.

8
Does the test-reports directory exist (in Jenkins workspace)? I can not test in the moment, but I think it has another name on our system. - shallowThought
@shallowThought - Yes its exist. - iPatel
Have you solved the problem? I am stuck with the same issue. - rokridi
Did you find the solution, Coz I am having the same issue? Do we need to create .xml file manually or let Jenkins create it. - Rajat jain
For the 'not configured for the test action' error, see this other question. without the project being properly configured for testing, you will not end up with a results file. stackoverflow.com/questions/30481630/… - Scriptable

8 Answers

31
votes

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'
16
votes

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

8
votes

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"
4
votes

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.

3
votes

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
0
votes

I had the same problem and my test report file name got changed due to an upgrade in scala version,

Hence I have to change from,

junit '/myworkspace/target/myreport.xml'

to

junit '/myworkspace/target/TEST-myreport.xml'
0
votes

How about:

junit allowEmptyResults: true, testResults: "${WORKSPACE}/test-results/*.xml"

or just:

junit "${WORKSPACE}/test-results/*.xml"
0
votes

You have to find the path where your test reports are saved in your .jenkins workspace:

/Users/<USERNAME/>/.jenkins/workspace/<PROJECT/>/target/surefire-reports/*.xml

to find the folder type in your terminal:

.jenkins

then

open .