PDF Ng Report

This is the pdf report plugin library written for testng/selenium, this listener will generate the pdf report on test cases run, its very simple to configure no need to write any code.


No Coding Just Configuration ! Free, Open source PDF report generator library for testng/selenium framework

Download sample pdf report Eclipse sample code Ant/Maven sample code

Quick start

Environment and dependent jar file


  • Minimum JDK 1.6 or higher
  • Jfree jar
  • Apache FOP jar

POM.xml


<dependency>
        <groupId>com.uttesh</groupId>
        <artifactId>pdfngreport</artifactId>
        <version>2.1.3</version>
</dependency>

Maven central repository

testng suit xml file


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Simple Reporter Suite">

  <parameter name="pdfngreport-properties" value="D:\property_files\pdfngreport.properties" />

  <listeners>
    <listener class-name="com.uttesh.pdfngreport.PDFReportListener" />
  </listeners>

  <test name="Simple Reporter test">
    <classes>
      <class name="xyz" />
      <class name="abc" />
    </classes>
  </test>
</suite>

pdfngreport.properties file


#Title
pdfreport.title.text=Report Title Here
pdfreport.title.align=left

# application build version
pdfreport.app.build.version=Build v2.0.8

# Build System Details manual/code/hide code is default, use hide for not to display
# enable below only for manual setting by setting code mode it will automactically populate the values in report
# manual only for the mobile/tab env related details
pdfreport.build.system.details.by=code
#pdfreport.additional.line1=OS : testOS (64 bit)
#pdfreport.additional.line2=SYSTEM : test@testingbox
#pdfreport.additional.line3=Lorem ipsum dolor sit amet


#TimeColumn Date Format
#"yyyy.MM.dd G 'at' HH:mm:ss z" | 2001.07.04 AD at 12:08:56 PDT
#"EEE, MMM d, ''yy" | Wed, Jul 4, '01
#"h:mm a"  |  12:08 PM
#"hh 'o''clock' a, zzzz" | 12 o'clock PM, Pacific Daylight Time
#"K:mm a, z" | 0:08 PM, PDT
#"yyyyy.MMMMM.dd GGG hh:mm aaa" | 02001.July.04 AD 12:08 PM
#"EEE, d MMM yyyy HH:mm:ss Z"  |  Wed, 4 Jul 2001 12:08:56 -0700
#"yyMMddHHmmssZ" | 010704120856-0700
#"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" |  2001-07-04T12:08:56.235-0700
#"yyyy-MM-dd'T'HH:mm:ss.SSSXXX" |  2001-07-04T12:08:56.235-07:00
#"YYYY-'W'ww-u" | 2001-W27-3

pdfngreport.time.column.format=MMMM dd YYYY hh:mm:sss

#Logo
pdfreport.logo=show
pdfreport.report.logo.file=E:/rivetsys/automation/pdfnglogo/logo.png
pdfreport.report.logo.align=right

# chat related
pdfreport.pie.chart.type=normal
#pdfreport.pie.chart.type=explode

# pdf report output location
pdfreport.outputdir=E:/rivetsys/automation/pdfngreport

# pdf report file name
pdfreport.file.name=sample_pdf_report

# tables/page setting : show/hide
pdfreport.exception.page=hide

# Below setting only for selenium user for selenium failed screen shot link show related
#pdfreport.show.selenium.screenshot.link=show
#pdfreport.selenium.failed.test.screenshot.outputdir=E:/rivetsys/automation/loan_connector_10Sep14Nova/loan_connector/screenshots

# error screen shot/image name standards.
#image type : png 
#image name : className + "_" + methodName


# for the better view or use of the space please use only 4 column. showing all columns will make the view cluttered : show/hide
pdfreport.table.column.time=show
pdfreport.table.column.test=show
pdfreport.table.column.case=show
pdfreport.table.column.timetaken=hide
pdfreport.table.column.description=show


# Custom color setting Coming soon on 3.0.0 version

pdfngreport.properties file can be in any location just provide full real path of the file.
windows :

<parameter name="pdfngreport-properties" value="d:/application/properties/pdfngreport.properties" />

linux :
<parameter name="pdfngreport-properties" value="/user/home/application/pdfngreport.properties" />

Miscellaneous

1. If dataproviders are used in the test classes and need to update test case dynamically on scenario data base do the following changes.
a. Test class should implements 'ITest'
public class DynamicDataProviderTestName implements ITest {
b. Add @BeforeMethod(alwaysRun = true) method to update the test cases dynamically according to data provider data.
@BeforeMethod(alwaysRun = true)
    public void testData(Method method, Object[] testData) {
        String testCase = "";
        if (testData != null && testData.length > 0) {
            TestParameters testParams = null;
            String _dyna_name = null;
            //Check if test method has actually received required parameters
            for (Object testParameter : testData) {
                if (testParameter instanceof TestParameters) {
                    testParams = (TestParameters) testParameter;
                    break;
                }
                if (testParameter instanceof String) {
                    _dyna_name = (String) testParameter;
                    break;
                }
            }
            if (testParams != null) {
                testCase = testParams.getTestName();
            }
            if(_dyna_name!=null){
                testCase = _dyna_name;
            }
        }
        this.mTestCaseName = String.format("%s(%s)", method.getName(), testCase);
    }
c. Full Test sample class
DynamicDataProviderTestName.java
TestParameters.java

Code examples


Eclipse sample code Ant/Maven sample code