Skip to content

Commit

Permalink
Merge pull request #1058 from Aman1905/stage
Browse files Browse the repository at this point in the history
extent reports completed
  • Loading branch information
Ishavyas9 authored Nov 1, 2024
2 parents f8cebf2 + 2b09431 commit 9764068
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/cucumber-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
99 changes: 63 additions & 36 deletions docs/extent-report.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -35,53 +35,84 @@ slug: extent-report/
})
}}
></script>
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 title="pom.xml"
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
```

## 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<ExtentTest> 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 title="pom.xml"
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.0</version>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.9</version> <!-- Use latest version available -->
</dependency>
```

### 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<ExtentTest> 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
Expand All @@ -92,7 +123,3 @@ partialReports:
```

<img loading="lazy" src={require('../assets/images/hyperexecute/knowledge-base/reports/extent.png').default} alt="Image" className="doc_img"/>
## 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.
7 changes: 2 additions & 5 deletions docs/native-extent-report.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -37,9 +37,6 @@ slug: native-extent-report/
})
}}
></script>

# 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
Expand Down
8 changes: 2 additions & 6 deletions docs/specflow-report.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -35,11 +35,7 @@ slug: specflow-report/
})
}}
></script>

# 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
Expand Down

0 comments on commit 9764068

Please sign in to comment.