Skip to content

Commit

Permalink
cucumber reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman1905 committed Nov 1, 2024
1 parent 30ac924 commit 7acf1e3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
Binary file modified assets/images/hyperexecute/knowledge-base/reports/cucumber.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 29 additions & 24 deletions docs/cucumber-report.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
id: cucumber-report
title: Cucumber Report on HyperExecute
hide_title: true
title: Cucumber Report
hide_title: false
sidebar_label: Cucumber
description: Learn how to generate Cucumber Report on lambdatest and download the reports from the dashboard
keywords:
- cucumber testing reports
- cucumber testing lambdatest

url: https://www.lambdatest.com/support/docs/cucumber-report/
site_name: LambdaTest
slug: cucumber-report/
Expand Down Expand Up @@ -35,41 +34,47 @@ slug: cucumber-report/
})
}}
></script>
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.

# Cucumber Reports
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.

Cucumber uses reporter plugins to produce reports that contain information about what scenarios have passed or failed.

## Built-in Reporters
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.
## Steps to Generate Cucumber Reports on HyperExecute

Following are some of the built-in reporters:
- message
- progress
- pretty
- html
- json
- rerun
- junit
- testng
### Step 1: Configure the TestRunner File
In your `TestRunner` file, configure `@CucumberOptions` to specify report formats and output paths. Here’s an example configuration:

## Custom Reporters
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.
```javascript
@CucumberOptions(
features = "src/main/java/Features",
glue = {"Steps"},
tags = {"~@Ignore"},
format = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"
},plugin = "json:target/cucumber-reports/CucumberTestReport.json")
```

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

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

**Step 1:** Configure the report parameters in the HyperExecute YAML file.
### Step 2: 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:

```bash
```yaml title="hyperexecute.yaml"
report: true
partialReports:
location: target/cucumber-reports/
frameworkName: cucumber
type: json
```
**Step 2:** Now execute your job by triggering the HyperExecute CLI. You can visit the HyperExecute dashboard to download the report after job completion.
### Step 3: Execute Your Tests
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.
<img loading="lazy" src={require('../assets/images/hyperexecute/knowledge-base/reports/cucumber.png').default} alt="Image" className="doc_img"/>

0 comments on commit 7acf1e3

Please sign in to comment.