Saturday, May 12, 2012

Generate TestNG-xslt report using Maven

Earlier I had covered in my blog on how to generate a TestNG-xslt report for your TestNG test-case execution using Ant. Following is the link to it:
http://blog.varunin.com/2010/05/generating-selenium-reports-using.html

As many of the recent projects are now using maven as their build tool ,test-cases are also required to integrate itself to the existing build. In this blog I will mention about how to generate a TestNG-xslt report for your TestNG test-case execution using Maven.
Following is the "pom.xml" file for executing TestNG test-cases and to generate a "TestNG-xslt" report for the same:


  4.0.0
  com.testng.app
  my-testng
  jar
  my-testng
  1.0-SNAPSHOT
  http://maven.apache.org
 
  
  src
    
      
        org.apache.maven.plugins
        maven-surefire-plugin
        2.14.1
        
          
            testng.xml
          
        
      
      
        maven-compiler-plugin
        
          iso-8859-1
          1.7
          1.7
        
      
    
  
 
  
    
    
      
        org.reportyng
        reporty-ng
        1.2
        
          
          /target/testng-xslt-report
          true
          FAIL,SKIP,PASS,CONF,BY_CLASS
          true
        
      
    
  
 
  
    
      org.testng
      testng
      6.3.1
    
  
 
  
    
      reporty-ng
      https://github.com/cosminaru/reporty-ng/raw/master/dist/maven
    
  
 

Run the following command in terminal/command prompt to run your test cases and generate the TestNG-xslt report. The report will be generated under folder named "testng-xslt-report" inside the "target" folder under your build directory.

mvn clean test site org.reportyng:reporty-ng:1.2:reportyng

To know more about the TestNG-xslt configuration parameters please refer to my earlier blog post:
http://blog.varunin.com/2010/05/generating-selenium-reports-using.html