Skip to main content

Extent Reports

 


1.      ExtentReports is an logger-style reporting library for automated tests.

2.      A logger is simply an object to log messages or events for a specific system or application.

3.      ExtentReports uses the logging style to add information about test sessions, such as creation of tests, adding screenshots, assigning tags, and adding events or series of steps to sequentially indicate the flow of test steps.

 

Extent Reports in Selenium contain two frequently used classes:

·        ExtentReports class

·        ExtentTest class

Syntax

ExtentReports reports = new ExtentReports("Path of directory to store the resultant HTML file", true/false);

ExtentTest test = reports.startTest("TestName");

 

Both classes can be used with the following built-in methods:

·        startTest: Executes preconditions of a test case

·        endTest: Executes postconditions of a test case

·        Log: Logs the status of each test step onto the HTML report being generated

·        Flush: Erases any previous data on a relevant report and creates a whole new report

A Test Status can be indicated by the following values:

·        PASS

·        FAIL

·        SKIP

·        INFO

Syntax:

test.log(LogStatus.PASS,”Test Passed”);

Maven Dependency:

<dependency>

                                             <groupId>com.relevantcodes</groupId>

                                             <artifactId>extentreports</artifactId>

                                             <version>2.41.2</version>

                              </dependency>


 

Benefits of Extent Reports:

  1.         They can be integrated with TestNG and Junit
  2.         screenshots can be captured and displayed for each step in a test
  3.         They show the time needed for test execution
  4.        They can be customized to graphically represent each step in a test.














Comments

Popular posts from this blog

Reading the data from a text file in Java and Selenium : There are two approaches where we can get the data from the text file that is file reader and buffered reader  this class allows us to get the data from the text file with the methods of its implementation like read() and readline() Code: Which can read the data character by character using the method read() public class filereader_character { public static void main(String[] args) throws Exception { FileReader reader = new FileReader("E:\\eclipseprojects\\Demoprojects\\seleniuminterviewQA\\testfile\\test.txt"); int character; while((character = reader.read()) != -1) { System.out.print((char) character); } reader.close(); } } Code: Which can read the data by string line using the method readline() public class filerreader_lines { public static void main(String[] args) throws IOException { FileReader reader1 = new FileReader("E:\\eclipseprojects\\Demoprojects\\seleniuminterviewQA\\testfil...

How to Handle Tooltips using selenium Webdriver.

Handling the tooltips are easy in selenium, we can achieve by using getAttribute("title"). where tooltips value is given in title attribute.  Do check out below code for implementation:   package SeleniumBasics; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; public class Seleniumtooltips {      public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "E:\\eclipseprojects\\seleniumDemo\\server\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("https://www.facebook.com/"); WebElement link1 = driver.findElement(By.linkText("Sign Up")); JavascriptExecutor scroll = (JavascriptExecutor) driver; scroll.executeScript("window.scroll...

How to write the defect report in software testing

 Defect report: In software testing its most important to find defects and let developer know about the defect. during this process of identifying the defect and reporting we need to follow some standard templates to report.  here is defect report template:  Refer the video for details: