25582

Jenkins Publish TestNG Results not working

Question:

I am running <em>Jenkins 1.571</em>. I am building my project with a pom.xml. I have two executions of maven-surefire-plugin to execute two testng suites in a forked mode.

But Jenkins build#/testReport page shows test results for only first suite. Build logs show test cases from both suites are successfully executed.

I want to include results from both suites into report, so I added Publish TestNG Results plug-in, but that doesn't show any results at all. Any idea on what I might be missing?

In my Jenkins configuration, I specified 'TestNG XML report pattern' = '**/target/surefire-reports/testng-results.xml'

Build log shows:

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. Finished: SUCCESS

My relevant pom.xml:

<!-- run unit test cases --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.4</version> <configuration> <environmentVariables> <outputDirectory>${project.build.directory}</outputDirectory> </environmentVariables> </configuration> <executions> <execution> <id>default-test</id> <configuration> <forkMode>once</forkMode> <suiteXmlFiles> <suiteXmlFile>${basedir}/src/test/testngSuite1.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </execution> <execution> <id>special-test</id> <phase>test</phase> <goals> <goal>test</goal> </goals> <configuration> <forkMode>always</forkMode> <suiteXmlFiles> <suiteXmlFile>${basedir}/src/test/testngSuite2.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </execution> </executions> </plugin>

Answer1:

Eventually I found out that I need to use forward slash for TestNG plugin to locate the file (My Jenkins runs on Windows).

TestNG Reports Processing: START Looking for TestNG results report in workspace using pattern: C:/workspace/project/target/surefire-reports/Suite1/UnitTests.xml;C:/workspace/project/target/surefire-reports/Suite2/UnitTests.xml Saving reports... Processing 'C:\programs\Jenkins\jobs\project\builds\2014-10-02_21-57-48\testng\testng-results-1.xml' Processing 'C:\programs\Jenkins\jobs\project\builds\2014-10-02_21-57-48\testng\testng-results.xml' TestNG Reports Processing: FINISH Finished: SUCCESS

Also this reference helped: <a href="http://www.seleniumtests.com/p/testing-forum.html#nabble-td5001883" rel="nofollow">http://www.seleniumtests.com/p/testing-forum.html#nabble-td5001883</a>

Answer2:

1.Select "Editable Email Notification" on Post-Build actions.

2.In the Default Content section : remove $DEFAULT_CONTENT.Place the following code to inject your html report into the default content :-

${FILE,path=”relative path to html file”}

Eg: ${FILE,path=”MyWorkspace/MyProj/test-output/emailable-report.html”}

More detailed steps given below in my tech blog:-

<a href="https://itisatechiesworld.wordpress.com/2015/01/06/including-testng-reports-within-the-jenkins-email-notifications/" rel="nofollow">https://itisatechiesworld.wordpress.com/2015/01/06/including-testng-reports-within-the-jenkins-email-notifications/</a>

Also let me know if you have any other reporting related questions using Jenkins. Will try to help out. :)

Regards, VJ

Recommend

  • Error uploading big extensions to joomla on a localhost
  • How to create my above listview to look more professional?
  • Suds write request missing datatype?
  • HTML5 canvas drawImage not working on first click
  • Write-Error does not print to console before script exits
  • WPF - how to best implement a panel with draggable/zoomable children?
  • PyAudio: when is it safe to modify the callback buffer?
  • Status bar overlaps toolbar
  • How to disable TRACE/TRACK HTTP in JBoss Wildfly?
  • Aurelia bundling fails when using relative import path
  • PAX-URL: “Protocol not supported” at Felix's startup
  • How to get a item's coordinates while it is animating?
  • Deploying Tizen app to Gear S2: Non trusted certificate is used
  • UILabel Refresh
  • Magit : how to see pre-commit hooks before editing commit log?
  • Android memory leak glide
  • How to produce a Code 39 that can be reliably read after faxing
  • console.log printing statements in the wrong order for learnyounode node.js tutorial
  • Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2
  • Gradle test fails with NullPointerException
  • Can someone please explain how this implementation of bucket sort works?
  • Where to put clearQueue in jQuery code
  • How to import Navit into Eclipse and use it in own android project
  • Mapping two workspace folders to the same working directory
  • Wait for .each() .getJSON request to finish before executing a callback
  • Regex for Specific Tag
  • Do query loads all the data in memory
  • Python ImageIO Gif Set Delay Between Frames
  • Not able to aggregate on nested fields in elasticsearch
  • Textfile Structure (tables)
  • Swift: Switch statement fallthrough behavior
  • req.body is undefined - nodejs
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is there any way to bind data to data.frame by some index?
  • Busy indicator not showing up in wpf window [duplicate]
  • How can i traverse a binary tree from right to left in java?