1
votes
  • I have created Maven project in eclipse with Selenium & TestNG to create automation test scripts which I want to execute from Jenkins.
  • I have added testNG dependency and all other required dependencies in pom.xml to create the TestNG report.
  • In Jenkins I have added the TestNG plugin to publish the TestNG report and set the pattern as mention below. But testNG report is not getting generated in jenkins.

Even TestNG report is being generated while running script from eclipse but not for the current build or for recently executed test. It shows the different reports than current test execution(I guess it shows reports of previous build)

I'm getting the two below mentioned issues.

1. TestNG Reports Processing: START Looking for TestNG results report in workspace using pattern: D:/Repository/cellma_robust-automation/CellmaAutomationFramework/target/surefire-reports/testng-results.xml Did not find any matching files. Finished: SUCCESS

2. TestNG Reports Processing: START Looking for TestNG results report in workspace using pattern: ** /testng-results.xml testng-results.xml was last modified before this build started. Ignoring it. Saving reports... Found matching files but did not find any TestNG results. Finished: SUCCESS

Actual path of the TestNG report file: D:\Repository\cellma_robust-automation\CellmaAutomationFramework\target\surefire-reports\testng-results.xml

I have tried the following options but didn't work out for me.

  • Tried giving the full path of the TestNG report. Forward ans backward slash in the pattern.
  • I have tried different other options by changing the TestNG result file path but this is also not working.

Please share some inputs on how to resolve this issue.

"testng-results.xml" file is available in workspace. But it's failed to display the report.

Note: I am using Jenkins 2.46.2 in Windows 10.

I have attached screenshot of Jenkins Console Output. ConsoleOutput_Jenkins

Please do the helpful. Let me know whats going wrong with this configuration or m i missing some desired configuration.

2
how about cleaning report everytime before you run the tests. what happens then ?Gaurang Shah
I did not tried that. Would you please specify the steps to clean the reports as you mentioned.Mohini
Sometimes it generates the testNG reports in Jenkins, but not every time. But whenever Jenkins generate testNG reports after a build, it shows the reports of previous build instead of showing reports for current build.Mohini

2 Answers

0
votes
  1. go to the job and click on workspace
  2. Navigate to the generated testng xml file.
  3. copy the path and put that in job config. use *.xml or other wild card pattern.
  4. make sure you are running mvn clean test which will delete the old reports.
0
votes

A 'Publish JUnit test result report' plugin is required in the post build actions and supply the JUnit report xml path '**/surefire-reports/junitreports/*.xml' in the 'Test Report XMLs' . I had the same issue and it worked for me.