Lädt...


🔧 How to Generate Extent Reports in Selenium


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Reporting is an important step of test automation as it helps stakeholders understand the outcome of the test case, the status of the application’s health and potential issues.

What are extent reports?

Extent Reports is an open-source reporting library used with test automation tools. It can be integrated with testing frameworks like JUnit and TestNG. Extend Reports generates HTML documents that serve as interactive and detailed test execution reports. It provides reports that can depict results as pie charts along with features such as logging and screenshots. Moreover, TestNG provides a report by default, but they are generally less detailed. Additionally, while TestNG provides default reports, they lack the level of detail and interactivity that Extent Reports offer, such as graphical representations, logs, and screenshots.

How to use extent reports in selenium?

Extent Reports has two major components or classes namely:

  1. ExtentReports class
  2. ExtentTest class

Syntax

Image description

ExtentReports class generates the HTML reports and accepts two arguments.

First argument is the path where the report has to be generated and the second argument is whether the file has to be overwritten or a new file should be created.

True will be the default value to overwrite all the existing data.

The ExtentTest class logs each individual test step to the HTML report, allowing you to track the progress and results of the test case

The ExtentReports class and ExtentTest class can be used with the below built-in methods:

  1. startTest: To execute preconditions of a test case
  2. endTest: To execute postconditions of a test case
  3. Log: To log the status of each step
  4. Flush: Flush: This method clears any previous data from the memory and writes the final report to the designated output file.

How to generate reports?

  1. Add the extentreports-java-2.41.2.jar to the project buildpath.
  2. Create a new java class and add the below code:

Image description

Test execution begins with the startTest() method, annotated with @BeforeClass, which initializes the Extent Reports object. This method sets up the report by specifying the output file location and initializing the test case.

@test methods opens the chrome browser and launches the URL and validates the page Title with the expected and logs the test case status as Pass or Fail. endTest() method executes postconditions of the test case

How to log test steps and results?

Test Status can be PASS, FAIL, SKIP and INFO.

Image description

The log() method accepts two arguments, first is test status and second is message to be displayed in the report.

How to Add Screenshots to Extent Report?

Screenshots can be captured in the report if a test fails.

Image description

Benefits of using extent reports

  1. It is open source.
  2. It can be customized as per the requirements.
  3. It provides pictorial and pie chart representations of test results
  4. It can be easily integrated with frameworks like Junit , TestNG and Nunit.
  5. It allows users to attach screenshots when the test fails.
  6. It logs the test report for a detailed summary of the tests.

Conclusion:

The significance of reporting in Selenium using ExtentReports is to provide comprehensive and customizable reports. Extent Reports help to communicate and track defects effectively with stakeholders. The final goal is to lead to better testing approaches and faster defect resolution.

Source: This article was originally published at testgrid.io.

...

🔧 How to Generate Extent Reports in Selenium


📈 56.12 Punkte
🔧 Programmierung

🔧 DIFFERENCE BETWEEN SELENIUM IDE, SELENIUM WEBDRIVER AND SELENIUM GRID


📈 43.86 Punkte
🔧 Programmierung

📰 Las Vegas Reports Cyber Attack; Extent of Breach Unclear


📈 30.32 Punkte
📰 IT Security Nachrichten

🔧 Selenium 3 vs Selenium 4: What’s New and Improved in Test Automation


📈 29.24 Punkte
🔧 Programmierung

🔧 What is Selenium? Why do we use Selenium for Automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 What is selenium? Why do we use selenium for Automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 What is selenium? Why do we use selenium for Automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 What is selenium ? Why do we use selenium for automation ?


📈 29.24 Punkte
🔧 Programmierung

🔧 What is Selenium? Why do we use selenium for automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 What is Selenium? Why do we use Selenium for Automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 What is Selenium? Why do we use Selenium for Automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 what is selenium ?why do we use selenium for automation.


📈 29.24 Punkte
🔧 Programmierung

🔧 1.WHAT IS SELENIUM 2.USE OF SELENIUM FOR AUTOMATION


📈 29.24 Punkte
🔧 Programmierung

🔧 What is Selenium? Why do we use Selenium for automation?


📈 29.24 Punkte
🔧 Programmierung

🔧 what is selenium? why do we use selenium in automation?


📈 29.24 Punkte
🔧 Programmierung

📰 Words Scraper - Selenium Based Web Scraper To Generate Passwords List


📈 25.8 Punkte
📰 IT Security Nachrichten

📰 TeamViewer confirms extent of hack 'significant'


📈 20.77 Punkte
📰 IT Security Nachrichten

🕵️ Linux Kernel up to 4.17.10 fs/btrfs/extent-tree.c btrfs_root_node() denial of service


📈 20.77 Punkte
🕵️ Sicherheitslücken

📰 HackNotice Actions helps people to understand the extent of their data exposure


📈 20.77 Punkte
📰 IT Security Nachrichten

📰 UK fraud and cybercrime figures show extent of these threats


📈 20.77 Punkte
📰 IT Security Nachrichten

📰 Exclusive: Unredacted Ukraine Documents Reveal Extent of Pentagon’s Legal Concerns


📈 20.77 Punkte
📰 IT Security Nachrichten

📰 Atmospheric Dust May Have Hidden True Extent of Global Heating


📈 20.77 Punkte
📰 IT Security Nachrichten

📰 TeamViewer confirms extent of hack 'significant'


📈 20.77 Punkte
📰 IT Security Nachrichten

📰 What’s the extent that Google etc can sell my data?


📈 20.77 Punkte
📰 IT Security Nachrichten

🐧 [$] Per-extent encrypted keys for fscrypt


📈 20.77 Punkte
🐧 Linux Tipps

📰 Optus reveals extent of data breach, but stays mum on how it happened


📈 20.77 Punkte
📰 IT Security Nachrichten

🐧 To what extent is the free software movement a political philosophy?


📈 20.77 Punkte
🐧 Linux Tipps

🪟 Microsoft Surface slammed by NFL coach following loss, extent of damage unclear


📈 20.77 Punkte
🪟 Windows Tipps

🐧 [$] Disabling an extent optimization


📈 20.77 Punkte
🐧 Linux Tipps

📰 Canada Helping Australia Determine 'Full Extent' of Hack


📈 20.77 Punkte
📰 IT Security Nachrichten

📰 The extent multinationals are monopolising the talent pool in Kenya


📈 20.77 Punkte
📰 IT Security Nachrichten

matomo