Skip to content

Commit 0a93b4d

Browse files
authored
Merge pull request #1059 from Ishavyas9/main
cucumber ,extent reports
2 parents 6d1c1d1 + 48fb7fe commit 0a93b4d

File tree

5 files changed

+96
-71
lines changed

5 files changed

+96
-71
lines changed
11.4 KB
Loading

docs/cucumber-report.md

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
id: cucumber-report
3-
title: Cucumber Report on HyperExecute
4-
hide_title: true
3+
title: Cucumber Report
4+
hide_title: false
55
sidebar_label: Cucumber
66
description: Learn how to generate Cucumber Report on lambdatest and download the reports from the dashboard
77
keywords:
88
- cucumber testing reports
99
- cucumber testing lambdatest
10-
1110
url: https://www.lambdatest.com/support/docs/cucumber-report/
1211
site_name: LambdaTest
1312
slug: cucumber-report/
@@ -35,41 +34,47 @@ slug: cucumber-report/
3534
})
3635
}}
3736
></script>
37+
Cucumber reporting is a way to visualize and analyze test results when using the Cucumber testing framework. Cucumber is widely used for Behavior-Driven Development (BDD), allowing tests to be written in plain language using Gherkin syntax. The reports generated from Cucumber tests provide a readable format for stakeholders to understand the results, which helps in understanding the behavior of the system being tested without requiring technical expertise.
3838

39-
# Cucumber Reports
39+
Cucumber itself provides basic reporting in the command line, but additional plugins and tools can enhance the reporting experience, generating rich HTML or JSON reports.
4040

41-
Cucumber uses reporter plugins to produce reports that contain information about what scenarios have passed or failed.
42-
43-
## Built-in Reporters
44-
There several pre-defined or built-in reporters for Cucumber. Each reporter may present the test results in a different way, suitable for specific needs or preferences. These built-in reporters offer different levels of detail and visualization options, helping developers to understand the test results and identify any potential issues more effectively.
41+
## Steps to Generate Cucumber Reports on HyperExecute
4542

46-
Following are some of the built-in reporters:
47-
- message
48-
- progress
49-
- pretty
50-
- html
51-
- json
52-
- rerun
53-
- junit
54-
- testng
43+
### Step 1: Configure the TestRunner File
44+
In your `TestRunner` file, configure `@CucumberOptions` to specify report formats and output paths. Here’s an example configuration:
5545

56-
## Custom Reporters
57-
Apart from the built-in reporters, Cucumber Test also allows developers to create custom reporters i.e. you have the flexibility to define your own format and layout for displaying test results. Custom reporters are beneficial when you have specific reporting requirements or when you want to integrate the test results seamlessly into your existing development workflow.
46+
```javascript title="TestRunner.java"
47+
@CucumberOptions(
48+
features = "src/main/java/Features",
49+
glue = {"Steps"},
50+
tags = {"~@Ignore"},
51+
format = {
52+
"pretty",
53+
"html:target/cucumber-reports/cucumber-pretty",
54+
"json:target/cucumber-reports/CucumberTestReport.json",
55+
"rerun:target/cucumber-reports/rerun.txt"
56+
},plugin = "json:target/cucumber-reports/CucumberTestReport.json")
57+
```
5858

59-
This involves creating a class that implements/extends the standard formatter interface.
59+
Explanation of plugin Options:
6060

61-
## Steps to Generate Cucumber Reports on HyperExecute
61+
- **pretty :** Outputs readable format in console.
62+
- **html:target/cucumber-reports/cucumber-pretty :** Generates HTML report in the target directory.
63+
- **json:target/cucumber-reports/CucumberTestReport.json :** Generates JSON report, often required for CI/CD and advanced reporting.
64+
- **rerun:target/cucumber-reports/rerun.txt :** Logs any failed scenarios for rerun.
6265

63-
**Step 1:** Configure the report parameters in the HyperExecute YAML file.
66+
### Step 2: Configure the HyperExecute YAML File
67+
In your HyperExecute YAML configuration, define the [`report`](https://www.lambdatest.com/support/docs/deep-dive-into-hyperexecute-yaml/#report) parameters like this:
6468

65-
```bash
69+
```yaml title="hyperexecute.yaml"
6670
report: true
6771
partialReports:
6872
location: target/cucumber-reports/
6973
frameworkName: cucumber
7074
type: json
7175
```
7276
73-
**Step 2:** Now execute your job by triggering the HyperExecute CLI. You can visit the HyperExecute dashboard to download the report after job completion.
77+
### Step 3: Execute Your Tests
78+
Run your tests on HyperExecute using the CLI. After your job completes, you can visit the HyperExecute dashboard to download and view the Cucumber report.
7479
7580
<img loading="lazy" src={require('../assets/images/hyperexecute/knowledge-base/reports/cucumber.png').default} alt="Image" className="doc_img"/>

docs/extent-report.md

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: extent-report
3-
title: Extent Report on HyperExecute
4-
hide_title: true
3+
title: Extent Report
4+
hide_title: false
55
sidebar_label: Extent
66
description: Learn how to generate Extent Report on lambdatest and download the reports from the dashboard
77
keywords:
@@ -35,53 +35,84 @@ slug: extent-report/
3535
})
3636
}}
3737
></script>
38+
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.
3839

39-
# HyperExecute Extent Report
40-
41-
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..
40+
## Steps to Generate Extent Reports `(Version <= 2)` on HyperExecute
41+
Follow these steps to enable Extent Reports for your HyperExecute job:
4242

43-
### Prerequisites
43+
### Step 1: Add Dependency
44+
If using Maven, add the following dependency to your `pom.xml` file:
4445

45-
1. Upgrade to extent reporting version 5 in the `pom.xml` file.
46-
2. Update import statements in the codebase from `com.relevantcodes` (version 2) to `com.aventstack` (version 5).
46+
```xml title="pom.xml"
47+
<dependency>
48+
<groupId>com.relevantcodes</groupId>
49+
<artifactId>extentreports</artifactId>
50+
<version>2.41.2</version>
51+
</dependency>
52+
```
4753

48-
## Implementation Steps
54+
### Step 2: Create an Extent Report Listener
55+
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.
4956

57+
```java title="ExtentReportListenerV2.java"
58+
import com.relevantcodes.extentreports.ExtentReports;
59+
import com.relevantcodes.extentreports.ExtentTest;
60+
import com.relevantcodes.extentreports.LogStatus;
61+
import org.testng.ITestContext;
62+
import org.testng.ITestListener;
63+
import org.testng.ITestResult
64+
public class ExtentReportListenerV2 implements ITestListener {
65+
private static ExtentReports extent;
66+
private static ThreadLocal<ExtentTest> test = new ThreadLocal<>()
67+
@Override
68+
public void onStart(ITestContext context) {
69+
// Initialize ExtentReports with the report path
70+
extent = new ExtentReports("extent-report.html", true);
71+
extent.addSystemInfo("Environment", "QA").addSystemInfo("User", "Tester");
72+
}
73+
```
74+
---
75+
## Steps to Generate Extent Reports `(Version > 2)` on HyperExecute
5076
Follow these steps to enable Extent Reports for your HyperExecute job:
5177

52-
### 1. Upgrade Extent Reporting Version
53-
54-
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.
78+
### Step 1: Add Dependency
79+
If using Maven, add the latest extentreports dependency to `pom.xml` file:
5580

56-
```xml
81+
```xml title="pom.xml"
5782
<dependency>
58-
<groupId>com.aventstack</groupId>
59-
<artifactId>extentreports</artifactId>
60-
<version>5.0.0</version>
83+
<groupId>com.aventstack</groupId>
84+
<artifactId>extentreports</artifactId>
85+
<version>5.0.9</version> <!-- Use latest version available -->
6186
</dependency>
6287
```
6388

64-
### 2. Modify Import Statements
89+
### Step 2: Create an Extent Report Listener
90+
For Extent Reports > 2, use `ExtentHtmlReporter` to generate and customize the HTML report. Create `ExtentReportListener.java`:
6591

66-
Update import statements in your codebase to reflect the new package structure in Extent Reporting version 5. Replace `com.relevantcodes` with `com.aventstack`.
67-
68-
```java
69-
// Before
70-
import com.relevantcodes.extentreports.ExtentReports;
71-
import com.relevantcodes.extentreports.ExtentTest;
72-
73-
// After
92+
```java title="ExtentReportListener.java"
7493
import com.aventstack.extentreports.ExtentReports;
7594
import com.aventstack.extentreports.ExtentTest;
95+
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
96+
import com.aventstack.extentreports.reporter.configuration.Theme;
97+
import org.testng.ITestContext;
98+
import org.testng.ITestListener;
99+
import org.testng.ITestResult
100+
public class ExtentReportListener implements ITestListener {
101+
private static ExtentReports extent;
102+
private static ThreadLocal<ExtentTest> test = new ThreadLocal<>()
103+
@Override
104+
public void onStart(ITestContext context) {
105+
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent-report.html");
106+
htmlReporter.config().setTheme(Theme.STANDARD);
107+
htmlReporter.config().setDocumentTitle("Test Report");
108+
htmlReporter.config().setReportName("Automation Test Results")
109+
extent = new ExtentReports();
110+
extent.attachReporter(htmlReporter);
111+
}
76112
```
77113

78-
### 3. Generate JSON Reports
79-
80-
Make changes in your codebase to generate individual JSON reports. These reports will serve as the source for the Extent Reports.
81-
82-
### 4. Update HyperExecute YAML Configuration
83-
84-
In the HyperExecute YAML configuration, add the following section to instruct the HyperExecute systems to generate Extent Reports:
114+
## Configure the HyperExecute YAML File
115+
In your HyperExecute YAML configuration, define the [`report`](https://www.lambdatest.com/support/docs/deep-dive-into-hyperexecute-yaml/#report) parameters like this:
85116

86117
```yaml
87118
report: true
@@ -92,7 +123,3 @@ partialReports:
92123
```
93124

94125
<img loading="lazy" src={require('../assets/images/hyperexecute/knowledge-base/reports/extent.png').default} alt="Image" className="doc_img"/>
95-
96-
## Conclusion
97-
98-
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.

docs/native-extent-report.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: native-extent-report
3-
title: Native Extent Report on HyperExecute
4-
hide_title: true
3+
title: Native Extent Report
4+
hide_title: false
55
sidebar_label: Extent Native
66
description: Learn how to generate Native Extent Report on lambdatest and download the reports from the dashboard
77
keywords:
@@ -37,9 +37,6 @@ slug: native-extent-report/
3737
})
3838
}}
3939
></script>
40-
41-
# HyperExecute Extent Native Report
42-
4340
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.
4441

4542
### Prerequisites

docs/specflow-report.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: specflow-report
3-
title: SpecFlow Report on HyperExecute
4-
hide_title: true
3+
title: SpecFlow Report
4+
hide_title: false
55
sidebar_label: SpecFlow
66
description: Learn how to generate SpecFlow Report on lambdatest and download the reports from the dashboard
77
keywords:
@@ -35,11 +35,7 @@ slug: specflow-report/
3535
})
3636
}}
3737
></script>
38-
39-
# SpecFlow Reports
40-
4138
SpecFlow is a free tool for automating tests using BDD. It's often used to create automation scripts for .NET projects.
42-
4339
This technical document provides a guide on generating SpecFlow reports after executing tests on HyperExecute.
4440

4541
## Steps to Generate Cucumber Reports on HyperExecute

0 commit comments

Comments
 (0)