Skip to content

A HTML Report of test executions via TestNG (No code changes required, Export results)

License

Notifications You must be signed in to change notification settings

kasthurikranthikumar/testng-metrics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TestNg Metrics is a custom report generated using TestNG Listener. Which generate awesome html report without making any changes in your existing automation code

HitCount Maven Central PRs Welcome Maintenance Open Source Love png1


  • Sample Report link

Best viewed in desktop!


Key Features

  • 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* and Before*
  • Display dataprovider info for tests

Pre-requisite

  • JDK 8+
  • TestNG 6+

How to use in Project:

Maven:

  1. Add testng-metrics dependency in pom.xml

    <dependency>
      <groupId>com.github.adiralashiva8</groupId>
      <artifactId>testng-metrics</artifactId>
      <version>1.5</version>
    </dependency>
    
  2. Perform maven install

  3. Execute test cases

  4. 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

ANT

 <dependency org="com.github.adiralashiva8" name="testng-metrics" rev="1.5" />

GRADLE Groovy DSL

 implementation 'com.github.adiralashiva8:testng-metrics:1.5'

GRADLE Kotlin DSL

 compile("com.github.adiralashiva8:testng-metrics:1.5")

Not a Maven Project?

  1. Download testng-metrics.jar from here

  2. 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
  3. Execute test cases

  4. TestNG Metrics report metric-timestamp.html file will be created


Customize LOGO:

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>

Archiving Reports:

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


Credits:

  1. TestNG link
  2. Stackoverflow link
  3. Google charts link
  4. DataTable link
  5. Java link
  6. Jquery | JavaScript link
  7. Bootstrap link
  8. Icons8 link
  9. FontAwesome link

Note: Testng-metrics uses above mentioned open-source libraries in report.


Special Thanks To:

Contributors:

  1. 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
  2. Saurabh Gupta

    • Contributed source to display data-provider info in Test Metrics
    • Added brand LOGO for TestNG Metrics
  3. Nainappa Illi

    • Contributed source to archive test-output folder and display execution time

Feedback:

  1. Venkateswara Reddy G

  2. Testng Users Community


STAR repo to appreciate us!


Inspired from robotframework-metrics


About

A HTML Report of test executions via TestNG (No code changes required, Export results)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%