Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/uttesh/pdfngreport

This is the pdf report plugin library written for testng/selenium frameworks, this listener will generate the pdf report on testcases execution, its very simple to configure no need to write any code.
https://github.com/uttesh/pdfngreport

ant java listener pdf-report pom selenium selenium-java testng

Last synced: about 7 hours ago
JSON representation

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

Awesome Lists containing this project

README

        

pdfngreport (PDF report plugin for TestNG)
==========================================

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.uttesh/pdfngreport/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.uttesh/pdfngreport/)
[![Build Status](https://travis-ci.org/uttesh/pdfngreport.svg)](https://travis-ci.org/uttesh/pdfngreport)

Join our online chat at [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/uttesh/pdfngreport?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

PDF NG Report home page http://uttesh.github.io/pdfngreport/

======================================================================
This is the part of maven repository now,Directly add in pom following.


com.uttesh
pdfngreport
2.1.3


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

How to use pdfngreport Plugin


Download latest version of pdfreport download

Sample demo example source download sample

eclipse sample code download eclipse sample

PDF report sample report

pdf report preview snaps :

![demo](https://raw.github.com/uttesh/pdfngreportdemo/master/report_snaps/pdfngreport_1.png)
![demo](https://raw.github.com/uttesh/pdfngreportdemo/master/report_snaps/pdfngreport_2.png)
![demo](https://raw.github.com/uttesh/pdfngreportdemo/master/report_snaps/pdfngreport_3.png)
![demo](https://raw.github.com/uttesh/pdfngreportdemo/master/report_snaps/pdfngreport_4.png)
explode pie chart
![demo](https://raw.github.com/uttesh/pdfngreportdemo/master/report_snaps/pdfngreport_5.png)

Environment and dependent jar file


1. Minimum JDK 1.6 or higher
2. Jfree jar
3. Apache fop jar

ANT users configuration



Download latest jfree and Apache fop jars from respective links and keep in lib.

ANT/MAVEN sample demo example demo source

configure build.xml file with below testng tag

```


```
If linteners configured in ant build.xml then no need configure/set listener in testsuit xml, if configured both placess it will call PDFReportListener class two times.

MAVEN users configuration


Add below jfree and apache fop dependencies in pom.xml

```

jfree
jfreechart
1.0.13


org.apache.xmlgraphics
fop
1.1


org.apache.avalon.framework
avalon-framework-api
4.3.1


org.apache.avalon.framework
avalon-framework-impl
4.3.1

```

To use the reporting plug-in, set the "listeners" attribute of the "testng"
element in your Ant build file.The class names for the pdfreport is:

```
com.uttesh.pdfngreport.PDFReportListener

```

You may also want to disable the default TestNG reporters by setting the
"useDefaultListeners" attribute to "false".

POM testng configuration with pdfngreport plugin paramerters

```

org.apache.maven.plugins
maven-surefire-plugin
2.17


testng.xml



usedefaultlisteners
false




```

For Maven pom.xml configuration, Add this dependecy.

```

com.uttesh
pdfngreport
2.1.3

```

testng suit xml file


```










```
set the following in the respective properties file for globel parameter pdfngreport-properties
```
#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, hide is default
# 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

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

#report file name
pdfreport.file.name=sample_pdf_report

# pdf report output location note: use duble forward slash for the windows system
pdfreport.outputdir=E://rivetsys//automation//pdfngreport

# 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

# Custom color setting Coming soon on 3.0.0 version

```

## Properties

property | default | description
---------|---------|------------
`pdfreport.title.text` | | Specifies the required report title.
`pdfreport.title.align` | left | align the title left/right
`pdfreport.app.build.version` | | Specifies the required application build version.
`pdfreport.build.system.details.by` | | Build System Details manual/code/hide
`pdfreport.additional.line1` | | by setting the system details properties, we can set this for the manual system details data entry
`pdfreport.additional.line2` | | by setting the system details properties, we can set this for the manual system details data entry
`pdfreport.additional.line3` | | by setting the system details properties, we can set this for the manual system details data entry
`pdfngreport.time.column.format` | MMMM dd YYYY hh:mm:sss | set date format for the test case execution time display.
`pdfreport.logo` | hide | by setting this property along with below properties we can add logo image to report
`pdfreport.report.logo.file` | no default value | set the location of the logo image
`pdfreport.report.logo.align` | right | align the logo image right/left
`pdfreport.pie.chart.type` | normal | set the values 'explode' for the ex[plode pie chart
`pdfreport.file.name` | | set the report file name
`pdfreport.outputdir` | | set the location where generated report will be saved
`pdfreport.table.column.time` | | set the value to show/hide the column in the report table
`pdfreport.table.column.test` | | set the value to show/hide the column in the report table
`pdfreport.table.column.case` | | set the value to show/hide the column in the report table
`pdfreport.table.column.timetaken` | | set the value to show/hide the column in the report table
`pdfreport.table.column.description` | | set the value to show/hide the column in the report table

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

Contributions
=============

All credit goes to jfree and Apache fop open source jar file which were used to generate the pdf report and pie chart statistic graph.

PDFngreport Developer : uttesh.com


License

(The Apache License)

Copyright (c) 2016 Uttesh Kumar T.H.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.