From 51721f8d66fc0a9b052c285fb3598e324a20e1a2 Mon Sep 17 00:00:00 2001 From: Aman Chopra Date: Fri, 1 Nov 2024 17:09:23 +0530 Subject: [PATCH 1/2] extent reports completed --- docs/cucumber-report.md | 2 +- docs/extent-report.md | 99 +++++++++++++++++++++++------------- docs/native-extent-report.md | 7 +-- docs/specflow-report.md | 8 +-- 4 files changed, 68 insertions(+), 48 deletions(-) diff --git a/docs/cucumber-report.md b/docs/cucumber-report.md index bcab9330..e17d1853 100644 --- a/docs/cucumber-report.md +++ b/docs/cucumber-report.md @@ -43,7 +43,7 @@ Cucumber itself provides basic reporting in the command line, but additional plu ### Step 1: Configure the TestRunner File In your `TestRunner` file, configure `@CucumberOptions` to specify report formats and output paths. Here’s an example configuration: -```javascript +```javascript title="TestRunner.java" @CucumberOptions( features = "src/main/java/Features", glue = {"Steps"}, diff --git a/docs/extent-report.md b/docs/extent-report.md index f4642c21..75a8c1ff 100644 --- a/docs/extent-report.md +++ b/docs/extent-report.md @@ -1,7 +1,7 @@ --- id: extent-report -title: Extent Report on HyperExecute -hide_title: true +title: Extent Report +hide_title: false sidebar_label: Extent description: Learn how to generate Extent Report on lambdatest and download the reports from the dashboard keywords: @@ -35,53 +35,84 @@ slug: extent-report/ }) }} > +Extent Reports is a powerful reporting library used in test automation frameworks to generate visually appealing and detailed test reports. It provides insights into the status of each test case, including whether they passed, failed, or were skipped, along with additional information such as logs, screenshots, and system/environment details. This makes it especially popular in Selenium, Appium, and API testing frameworks. -# HyperExecute Extent Report - -Extent Reports is a popular reporting framework for Java, TestNG, and Selenium tests. It provides a comprehensive set of features for reporting test results, including detailed test case summaries, screenshots and videos of test execution, execution logs, and charts and graphs to analyze test results.. +## Steps to Generate Extent Reports `(Version <= 2)` on HyperExecute +Follow these steps to enable Extent Reports for your HyperExecute job: -### Prerequisites +### Step 1: Add Dependency +If using Maven, add the following dependency to your `pom.xml` file: -1. Upgrade to extent reporting version 5 in the `pom.xml` file. -2. Update import statements in the codebase from `com.relevantcodes` (version 2) to `com.aventstack` (version 5). +```xml titile="pom.xml" + + com.relevantcodes + extentreports + 2.41.2 + +``` -## Implementation Steps +### Step 2: Create an Extent Report Listener +Create a class, e.g., `ExtentReportListenerV2.java`, to initialize and flush Extent Reports during test execution. This listener will log each test case’s status to the report. +```java title="ExtentReportListenerV2.java" +import com.relevantcodes.extentreports.ExtentReports; +import com.relevantcodes.extentreports.ExtentTest; +import com.relevantcodes.extentreports.LogStatus; +import org.testng.ITestContext; +import org.testng.ITestListener; +import org.testng.ITestResult +public class ExtentReportListenerV2 implements ITestListener { + private static ExtentReports extent; + private static ThreadLocal test = new ThreadLocal<>() + @Override + public void onStart(ITestContext context) { + // Initialize ExtentReports with the report path + extent = new ExtentReports("extent-report.html", true); + extent.addSystemInfo("Environment", "QA").addSystemInfo("User", "Tester"); + } +``` +--- +## Steps to Generate Extent Reports `(Version > 2)` on HyperExecute Follow these steps to enable Extent Reports for your HyperExecute job: -### 1. Upgrade Extent Reporting Version - -Update the `pom.xml` file to include the latest version of the Extent Reporting library (version 5). Ensure that the necessary dependencies are correctly configured. +### Step 1: Add Dependency +If using Maven, add the latest extentreports dependency to `pom.xml` file: -```xml +```xml titile="pom.xml" - com.aventstack - extentreports - 5.0.0 + com.aventstack + extentreports + 5.0.9 ``` -### 2. Modify Import Statements +### Step 2: Create an Extent Report Listener +For Extent Reports > 2, use `ExtentHtmlReporter` to generate and customize the HTML report. Create `ExtentReportListener.java`: -Update import statements in your codebase to reflect the new package structure in Extent Reporting version 5. Replace `com.relevantcodes` with `com.aventstack`. - -```java -// Before -import com.relevantcodes.extentreports.ExtentReports; -import com.relevantcodes.extentreports.ExtentTest; - -// After +```java title="ExtentReportListener.java" import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.reporter.ExtentHtmlReporter; +import com.aventstack.extentreports.reporter.configuration.Theme; +import org.testng.ITestContext; +import org.testng.ITestListener; +import org.testng.ITestResult +public class ExtentReportListener implements ITestListener { + private static ExtentReports extent; + private static ThreadLocal test = new ThreadLocal<>() + @Override + public void onStart(ITestContext context) { + ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent-report.html"); + htmlReporter.config().setTheme(Theme.STANDARD); + htmlReporter.config().setDocumentTitle("Test Report"); + htmlReporter.config().setReportName("Automation Test Results") + extent = new ExtentReports(); + extent.attachReporter(htmlReporter); + } ``` -### 3. Generate JSON Reports - -Make changes in your codebase to generate individual JSON reports. These reports will serve as the source for the Extent Reports. - -### 4. Update HyperExecute YAML Configuration - -In the HyperExecute YAML configuration, add the following section to instruct the HyperExecute systems to generate Extent Reports: +## Configure the HyperExecute YAML File +In your HyperExecute YAML configuration, define the [`report`](https://www.lambdatest.com/support/docs/deep-dive-into-hyperexecute-yaml/#report) parameters like this: ```yaml report: true @@ -92,7 +123,3 @@ partialReports: ``` Image - -## Conclusion - -By following these steps, your HyperExecute job will generate Extent Reports, providing a consolidated HTML report derived from individual JSON reports. This enhancement allows customers to access comprehensive and standardized reports conveniently at the conclusion of their HyperExecute jobs. \ No newline at end of file diff --git a/docs/native-extent-report.md b/docs/native-extent-report.md index a3b47277..b6de71dc 100644 --- a/docs/native-extent-report.md +++ b/docs/native-extent-report.md @@ -1,7 +1,7 @@ --- id: native-extent-report -title: Native Extent Report on HyperExecute -hide_title: true +title: Native Extent Report +hide_title: false sidebar_label: Extent Native description: Learn how to generate Native Extent Report on lambdatest and download the reports from the dashboard keywords: @@ -37,9 +37,6 @@ slug: native-extent-report/ }) }} > - -# HyperExecute Extent Native Report - The Extent Native Reports offer a standardized and easily accessible summary of information extracted from raw Extent reports per Virtual Machine (VM) at the end of a HyperExecute job. ### Prerequisites diff --git a/docs/specflow-report.md b/docs/specflow-report.md index 505d8e37..a43f82fb 100644 --- a/docs/specflow-report.md +++ b/docs/specflow-report.md @@ -1,7 +1,7 @@ --- id: specflow-report -title: SpecFlow Report on HyperExecute -hide_title: true +title: SpecFlow Report +hide_title: false sidebar_label: SpecFlow description: Learn how to generate SpecFlow Report on lambdatest and download the reports from the dashboard keywords: @@ -35,11 +35,7 @@ slug: specflow-report/ }) }} > - -# SpecFlow Reports - SpecFlow is a free tool for automating tests using BDD. It's often used to create automation scripts for .NET projects. - This technical document provides a guide on generating SpecFlow reports after executing tests on HyperExecute. ## Steps to Generate Cucumber Reports on HyperExecute From 2b0943146efea9f7269dcc09d09f7e0cdc91e100 Mon Sep 17 00:00:00 2001 From: Aman Chopra Date: Fri, 1 Nov 2024 17:11:14 +0530 Subject: [PATCH 2/2] spell update --- docs/extent-report.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/extent-report.md b/docs/extent-report.md index 75a8c1ff..fb68670d 100644 --- a/docs/extent-report.md +++ b/docs/extent-report.md @@ -43,7 +43,7 @@ Follow these steps to enable Extent Reports for your HyperExecute job: ### Step 1: Add Dependency If using Maven, add the following dependency to your `pom.xml` file: -```xml titile="pom.xml" +```xml title="pom.xml" com.relevantcodes extentreports @@ -78,7 +78,7 @@ Follow these steps to enable Extent Reports for your HyperExecute job: ### Step 1: Add Dependency If using Maven, add the latest extentreports dependency to `pom.xml` file: -```xml titile="pom.xml" +```xml title="pom.xml" com.aventstack extentreports