TestNg Metrics is a custom report generated using TestNG Listener. Which generate awesome html report without making any changes in your existing automation code
- Sample Report link
Best viewed in desktop!
- Dashboard View of execution results
- Top 10 Test Performances
- Sort and Search Results
- Export Results (pdf, excel,csv, print)
- Generate email (.eml) with statistics
- No Code changes required
- Metrics of
After*
andBefore*
- Display dataprovider info for tests
- JDK 8+
- TestNG 6+
-
Add testng-metrics dependency in pom.xml
<dependency> <groupId>com.github.adiralashiva8</groupId> <artifactId>testng-metrics</artifactId> <version>1.5</version> </dependency>
-
Perform maven install
-
Execute test cases
-
TestNG Metrics report metric-timestamp.html file will be created
By default, the report will be generated at TestNG's output directory. i.e.,
test-output/metric-timestamp.html
<dependency org="com.github.adiralashiva8" name="testng-metrics" rev="1.5" />
implementation 'com.github.adiralashiva8:testng-metrics:1.5'
compile("com.github.adiralashiva8:testng-metrics:1.5")
-
Download
testng-metrics.jar
from here -
Add
testng-metrics.jar
in your project- Open Eclipse → Right Click on the project
- Go to Property → Build Path → Configure Build Path
- Add the
testng-metrics.jar
in the libraries using Add External Jar button
-
Execute test cases
-
TestNG Metrics report metric-timestamp.html file will be created
Want to use Custom LOGO in testng-metrics then update testng.metrics.logo
JVM variable
-
From command line:
mvn clean test -Dtestng.metrics.logo="https://mycompanylog.jpg"
-
From testng.xml: Place following lines in testng.xml
<method-selectors>
<method-selector>
<script language="beanshell">
<![CDATA[ System.setProperty("testng.metrics.logo",
"https://mycompanylog.jpg");return true;]]>
</script>
</method-selector>
</method-selectors>
If you want to archive the entire test-output
folder along with testng-metrics report
, add the below parameter at suite level in your testng.xml
file
<parameter name="archive.testng.metrics.report" value = "true"/>
.
You can turn off this feature by either removing this parameter from testng file or by changing the value to false
.
Refer the testng.xml file in the repo.
This will create a folder in your:
.current.dir/TestNg_Metrics_Reports/<Results_dd_MMM_yy_hh_mm_ss>
Thanks for using testng-metrics!
- What is your opinion of this report?
- What’s the feature I should add?
If you have any questions / suggestions / comments on the report, please feel free to reach me at
- Email:
[email protected]
- LinkedIn:
shivaprasadadirala
- Twitter:
@ShivaAdirala
- Mailing List (google group):
testng-metrics
Credits:
- TestNG link
- Stackoverflow link
- Google charts link
- DataTable link
- Java link
- Jquery | JavaScript link
- Bootstrap link
- Icons8 link
- FontAwesome link
Note: Testng-metrics uses above mentioned open-source libraries in report.
Special Thanks To:
Contributors:
-
Krishnan Mahadevan [Automation GURU]
- Mavenised the project ( To consume it from Maven library )
- Converted the utility into a TestNG listener
- Guided to publish the library onto Maven Central
-
- Contributed source to display data-provider info in Test Metrics
- Added brand LOGO for TestNG Metrics
-
- Contributed source to archive test-output folder and display execution time
Feedback:
STAR
repo to appreciate us!
Inspired from robotframework-metrics