Skip to content

Commit 6e03d9f

Browse files
Copilotkobenguyent
andcommitted
Add comprehensive BDD/Gherkin support to HTML reporter plugin
- Implement BDD test detection based on .feature files and Gherkin syntax - Add specialized BDD step formatting with proper keywords (Given, When, Then, And) - Display feature information including name, description, and file path - Add BDD-specific CSS styling with purple theme and visual indicators - Include "Gherkin" badge and "Scenario:" prefix for BDD tests - Add test type filter to distinguish BDD from regular tests - Support BDD step timing, status indicators, and comments - Maintain full compatibility with existing HTML reporter features - Add comprehensive documentation for BDD support - Include BDD test configuration and test cases Co-authored-by: kobenguyent <[email protected]>
1 parent 5bd8da2 commit 6e03d9f

File tree

6 files changed

+450
-7
lines changed

6 files changed

+450
-7
lines changed

docs/plugins.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ Generates comprehensive HTML reports showing:
722722
723723
- **Interactive Test Results**: Click-to-expand test details with comprehensive information
724724
- **Step-by-Step Details**: Shows individual test steps with proper method names (e.g., `I.seeFile()`, `I.amInPath()`), status indicators, and timing
725+
- **BDD/Gherkin Support**: Full support for Gherkin feature files with proper scenario formatting, step keywords, and feature information
725726
- **Test Statistics**: Visual cards displaying totals, passed, failed, and pending test counts with interactive pie chart
726727
- **Error Information**: Clean, formatted error messages for failed tests with ANSI color code stripping
727728
- **Artifacts Support**: Display screenshots and other test artifacts with modal viewing capability
@@ -732,7 +733,7 @@ Generates comprehensive HTML reports showing:
732733
- **Tags Support**: Display and filter by test tags (@smoke, @critical, etc.)
733734
- **Retry Tracking**: Shows retry attempts and final test status
734735
- **Test Notes**: Display test notes and comments
735-
- **Interactive Filters**: Filter tests by status, feature, tags, and retry status
736+
- **Interactive Filters**: Filter tests by status, feature, tags, retry status, and test type (BDD vs Regular)
736737
- **Test History**: Track test results across multiple runs with visual charts
737738
- **Stats Export**: Export test statistics in JSON format for integration with external tools (Grafana, etc.)
738739
- **Worker Support**: Compatible with run-workers and run-multiple commands
@@ -815,6 +816,69 @@ History tracking provides:
815816
- Visual charts in the HTML report
816817
- JSON data for external analysis
817818
819+
### BDD/Gherkin Support
820+
821+
The HTML reporter provides comprehensive support for BDD/Gherkin feature files with enhanced formatting and visualization:
822+
823+
#### Key BDD Features
824+
825+
- **Automatic Detection**: Automatically detects BDD/Gherkin tests based on `.feature` files and Gherkin syntax
826+
- **Scenario Formatting**: Displays scenarios with proper "Scenario:" prefix and visual distinction from regular tests
827+
- **Feature Information**: Shows complete feature details including name, description, and file path
828+
- **Gherkin Steps**: Displays steps with proper keywords (Given, When, Then, And) in a BDD-friendly format
829+
- **BDD Badge**: Visual indicator distinguishing Gherkin tests from regular CodeceptJS tests
830+
- **Feature Tags**: Supports both feature-level and scenario-level tags with proper inheritance
831+
- **Test Type Filtering**: Filter reports to show only BDD tests, only regular tests, or both
832+
833+
#### BDD Configuration
834+
835+
No special configuration required - BDD support is automatically enabled when using Gherkin feature files:
836+
837+
```js
838+
// codecept.conf.js
839+
exports.config = {
840+
gherkin: {
841+
features: './features/*.feature',
842+
steps: './step_definitions/*.js'
843+
},
844+
plugins: {
845+
htmlReporter: {
846+
enabled: true,
847+
output: './output',
848+
reportFileName: 'report.html'
849+
}
850+
}
851+
}
852+
```
853+
854+
#### BDD Report Features
855+
856+
**Feature Display:**
857+
- Feature name and description prominently displayed
858+
- Feature-level tags shown with purple styling
859+
- File path information for traceability
860+
- Language support for internationalized Gherkin
861+
862+
**Scenario Formatting:**
863+
- Clear "Scenario:" prefix for test titles
864+
- "Feature:" prefix for feature grouping
865+
- Purple "Gherkin" badge for easy identification
866+
- Visual left border styling for BDD tests
867+
868+
**Step Visualization:**
869+
- Proper Gherkin keywords: Given, When, Then, And
870+
- Step text displayed with original Gherkin formatting
871+
- Execution timing for each step
872+
- Status indicators (pass/fail) for individual steps
873+
- Support for data tables and docstrings in step comments
874+
875+
**Enhanced Filtering:**
876+
- Test Type filter to show BDD-only or regular tests
877+
- All existing filters (tags, status, feature) work with BDD tests
878+
- Combined filtering for complex test selection
879+
880+
The BDD support seamlessly integrates with all existing HTML reporter features including retry tracking, history, stats export, and artifact display.
881+
818882
### Parameters
819883
820884
- `config` &#x20;

0 commit comments

Comments
 (0)