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

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.

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'

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

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"

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.

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

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'

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

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 .

Related

Jenkins fails to find SureFire Reports

Jenkins Version : 2.176.2
Executing Selenium tests via Jenkins : Ecplsie+mvn+Jenkins
Selenium Workspace Folder : C:\Users\admin\eclipse-workspace\ACA
The actual location of the testng-results.xml: C:\Users\admin\eclipse-workspace\ACA\target\surefire-reports\testng-results.xml
Jenkins Insatlled / Home Directory: C:\Program Files (x86)\Jenkins
Building in workspace C:\Program Files (x86)\Jenkins\workspace\ACATestAutomationJob
Executing Maven: -B -f C:\Users\admin\eclipse-workspace\ACA\pom.xml clean install
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/target/surefire-reports/testng-results.xml
Did not find any matching files.
How do i make jenkins locate this testng-results.xml?
Thanks,
Raj
Look into Jenkins Console Output, it should report where the build is running (so called WORKSPACE) and where TestNG Results Plugin attempts to locate the results file:
The path to the TestNG results file must be relative to the WORKSPACE and have the syntax of Ant FileSet
If you're uncertain regarding how to properly build the path to the test artifacts - post the full paths to WORKSPACE and the testng-results.xml / emailable-report.html and we will help you to come up with the correct definitions.
In the meantime you could use wildcard paths like:
**/testng-results.xml
so Jenkins will scan its WORKSPACE recursively looking for the testng-results.xml file in all available locations
Your install command also looks suspicious, normally you should not be putting your test artifacts to the Maven repository so you might want to use mvn test or mvn verify instead.
More information:
Turbo Boost Your Digital App Test Automation with Jenkins
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Jenkins TestNG plugin does not fetch results from the test-results.xml file

In my project workspace, the test-results.xml file exists inside the target\surefire-reports\testng-results.xml directory. But Jenkins fails to read the XML file and gives below error on console.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **\target\surefire-reports\testng-results.xml
Did not find any matching files.
To ensure the file isn't too old, I had checked that the test-results.xml (and other files) belong to the latest test run. The Jenkins server is running on Ubuntu 14.04 LTS.
I'm running my tests in this manner: My project root directory has a run_tests.sh script which looks like this:
#!/bin/bash
if [ "$1" = "" ]; then
echo "Please provide a valid suite XML file name."
else
mvn clean
mvn compile
mvn clean test -Dsurefire.suiteXmlFiles="$1"
fi
I just pass the suite XML file name as a parameter to this script in Jenkins (execute shell).
Please help.
I found the solution for this.
Go to Configure of your Job
in General Tab, you may find
Advanced Button, Click on this
Check the check box of "Use custom
workspace", under this you see the Directory text box, here you copy
your Selenium Workspace Folder, for example mine is
"E:\eclipse\eclipse-workspace\WebDriveTest\"
Scroll down the page
under the Post-build Actions, Publish TestNG Results, TestNG XML
report pattern : give like this
"**/target/surefire-reports/testng-results.xml" (check this path in
the same workspace).
I hope this will help you!.
You should be using / instead of \ (since you mentioned that your Jenkins is running on a UNIX box)
Krishnan, in the testng-users Google Group, pointed out that it could be an issue with my Jenkins project workspace, and it was the same.
I changed the default workspace in my Jenkins project.
So I've added the path "$HOME/myWorkspace/myProject/" in my Jenkins project workspace, and "**/target/surefire-reports/testng-results.xml" in my TestNG setting in the same Jenkins project, and it works!
Thank you Krishan for your help.
Please see my answer in another post here, it should be very clear.
In short, it is caused by the current directory was changed to the default Jenkins workspace, you need set your custom workspace in the Job's Config.
I agree with Krishnan Mahadevan usage of '\' instead of '/' while providing the path for TestNG Report also solved my problem.
Extremely important thing to note here:
When providing path for Root POM in the build section '\' is used
C:\Users\harsh\eclipse-workspace\ProjTwo3\pom.xml
When providing path for TestNG XML report pattern in Publish TestNG Result section
'/' is used
C:/Users/harsh/eclipse-workspace/ProjTwo3/target/surefire-reports/testng-results.xml
Console Output:
channel stopped
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern:
C:/Users/harsh/eclipse-workspace/ProjTwo3/target/surefire-reports/testng-results.xml
Saving reports...
Processing 'C:\Users\harsh.jenkins\jobs\MyApplication\builds\12\testng\testng-results.xml'
11.688312% of tests failed, which exceeded threshold of 0%. Marking build as UNSTABLE

failed archiving ipa files jenkins

I have a extrange problem,
when building the ios app with jenkins the ipa file is generated, and signed correctly but when I try to archive the ipa file it fails
the jenkins log says
Results at '/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa'
[Debug-iphoneos] $ ditto -c -k --keepParent -rsrc /Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/Debug-iphoneos/FormSlider.app.dSYM /Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion-dSYM.zip
Archiving artifacts
ERROR: No artifacts found that match the file pattern "/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa". Configuration error?
ERROR: ‘/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa’ doesn’t match anything: ‘’ exists but not ‘/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa’
Build step 'Archive the artifacts' changed build result to FAILURE
Finished: FAILURE
clearly it states that jenkins couldn't find the ipa but in the statement before shows that the ipa was generated also using the terminal to go to the build/ipa directory I cheked that the file currently exists and is generated,
any help would be appreciated
What do you use in your "Archive Artifacts" configuration? It should be relative to $workspace, so in your case just build/ipa/Verion.ipa.
Make sure there are no extra quotes either
When you navigate to this job folder is there a file there? If you are using Ant blob syntax try adding a "*" at the end in case the file extension you wrote in is incorrect or instead of "build/ipa/Verion.ipa" use "build/ipa/Verion*" to try and locate the file, as #Slav mentioned use a path relative to the $workspace

Failed to execute goal net.sf.mavenjython:jython-compile-maven-plugin:1.0:jython

I'm trying to run a jython script from my Junit testcases. I have included the maven-jython-plugin.jar and jython.jar as well. As well as updated my pom.xml file accordingly. But when I run 'mvn install', I get following error:
Failed to execute goal net.sf.mavenjython:jython-compile-maven-plugin:1.0:jython (pydevLockUnlock) on project NTLauncherTest: extracting org/python/antlr/op/AugLoad.class from jython artifact jar failed: target/jython-plugins-tmp/org/python/antlr/op/AugLoad.class (Too many open files)
Does anyone know what I might be doing wrong and have a solution for this?
The issue is that maven can keep a lot of jar filehandles open. Check out this link for suggestions on how to troubleshoot that.
http://www.thinkplexx.com/learn/howto/maven2/debug/fixing-too-many-open-files-maven-problem-solution-for-teamcity-hudson-local-and-ssh-shell-environments
I've found that just re-running mvn install can lead to a successful build.

Getting output from remote hudson builds

I have recently added several Hudson agent machines to a working controller.
Some of the builds have result files (Doxygen output, Boost unit test results, cppcheck) which are published using the relevant plugins.
If these builds run on the controller, the output files are published successfully, but if they run on an agent, the build fails because the files cannot be found.
The plugins seem to be looking for the output files on the controller, when of course, they are on the agent.
Is there a way to fix this?
Plugins used:
- Jenkins Cppcheck Plug-in V1.2
- Doxygen Plugin V0.9
- HTML Publisher plugin V0.6
Edit:
Tried archiving suggestion, but I can't get it to work. cppcheck.xml is archived correctly and exists in the relative directory ../lastSuccessful/archive/cppcheck.xml
Hudson log:
Archiving artifacts
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] No cppcheck test report file(s) were found with the pattern
'../lastSuccessful/archive/cppcheck.xml' relative to
'/home/hudson/.hudson/jobs/1.11-IntegrationDebug/workspace'.
Did you enter a pattern relative to the correct directory?
Did you generate the XML report(s) for Cppcheck?
[Cppcheck] Parsing throws exceptions. No cppcheck test report file(s) were
found with the pattern '../lastSuccessful/archive/cppcheck.xml' relative to
'/home/hudson/.hudson/jobs/1.11-IntegrationDebug/workspace'.
Workaround: copy artifacts into your workspace and publish from there.

Resources