0
votes

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.

4

4 Answers

1
votes

I found the solution for this.

  1. Go to Configure of your Job
  2. in General Tab, you may find
    Advanced Button, Click on this
  3. 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\"
  4. 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!.

0
votes

You should be using / instead of \ (since you mentioned that your Jenkins is running on a UNIX box)

0
votes

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.

0
votes

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.