Generating Reports in Selenium using TestNG

As we all know the function of test automation tool is to make the test execution in a successful manner, Also there are multiple factors which play an important role in making the test automation in a positive note. One such factor is “Test report” which helps you in finding the result of the test cases. In this way, you ought to carefully pick how you will create reports in Selenium Webdriver extend. That is the place this post would lead you to settle on a choice.

Here lets study about generating the Reports in Selenium using TestNG

Before going further it is important to know about the basics tips to design your test data properly, It is important to have a healthy test report in order to serve it with your clients. Hence regarding the status of the report sheet we can share it with our clients or can ship it with our team to focus on the potential bugs.

Characteristics of a decent Test Report

Quickness –

  • A report ought to be short and compact.
  • It ought to plainly express the extent of aggregate no. of accomplishment or disappointment.

Trackability –

  • Catches every one of the impressions that could prompt the underlying driver of a disappointment.

Traceability –

  • It must give the capacity to survey the accompanying.
  • Recorded information for test cases and disappointments.
  • Age of a specific disappointment.

Sharable –

  • It should bolster an arrangement which you can share through email or coordinate with CI instruments like Jenkins/Bamboo.

Test scope –

  • It should highlight the test scope for the accompanying.
  • Test scope of the module under test.
  • Test scope of the application under test.

Presently you would have picked up a reasonable thought of the way that how a decent test report can boost the profits on speculation.

What is TestNG Framework ?

TestNG is a testing framework which is developed with the same line of JUnit and NUnit, with that it consist of some more new functionality which makes it simple and easier to use.  Like selenium automation testing TestNG is also an open source automated testing framework.

Recommended ReadingFeatures and Benefits of TestNG Framework

Generating Reports in Selenium using TestNG

import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
public class GenerateReport implements ITestListener {
@Override
public void onStart(ITestContext arg0) {
System.out.println(“+Begin test: “ + arg0.getName());
}
@Override
public void onTestStart(ITestResult arg0) {
System.out.println(” Starting test: “ + arg0.getName());
}
@Override
public void onTestSuccess(ITestResult arg0) {
System.out.println(” Test passed: “ + arg0.getName());
}
@Override
public void onTestFailure(ITestResult arg0) {
System.out.println(” Test failed: “ + arg0.getName());
}
@Override
public void onTestSkipped(ITestResult arg0) {
System.out.println(” Test ignored: “ + arg0.getName());
}
@Override
public void onFinish(ITestContext arg0) {
System.out.println(“-End test: “ + arg0.getName());
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
// TODO Auto-generated method stub
}
}

Report for Generting reports in selenium using testNG:

Reports in Selenium using TestNG

Subscribe Here:

Tagged with: how to generate reports in selenium using testng | selenium reporting tools | testng report customization | selenium reporting framework | selenium report generation | selenium tutorial for beginners best selenium certification training in chennai