Report Generation
Reports are generated using theaggregate Gradle task:
Automatic Report Generation
The build.gradle configures automatic report generation after test execution:./gradlew test automatically triggers report aggregation when tests complete.
Report Location
Serenity reports are generated in thetarget/site/serenity/ directory:
Viewing Reports
Open the main report in your browser:Reports are static HTML files that can be:
- Opened directly in any browser
- Served by any web server
- Archived as build artifacts
- Published to CI/CD dashboards
Report Contents
Serenity reports provide multiple views of your test execution:Home Dashboard
The main dashboard (index.html) shows:
Test Results Summary
High-level metrics:
- Total scenarios executed
- Pass/fail/pending counts
- Success rate percentage
- Test execution duration
Test Result Breakdown
Visual representation:
- Pie chart of test outcomes
- Trend graphs over time
- Stability indicators
Requirements View
The requirements page (requirements.html) displays:
- Feature Hierarchy - Organized by directory structure from
src/test/resources/features/ - Scenario Coverage - Which scenarios cover each requirement
- Test Status - Visual indicators for each feature’s health
- Living Documentation - Feature descriptions and scenarios as documentation
Requirements Configuration
Requirements Configuration
The
serenity block in build.gradle configures requirements tracking:requirementsBaseDir- Points to feature file location- Serenity automatically builds requirement hierarchy from directory structure
Scenario Details
Click any scenario to see detailed execution information:Scenario Steps
Complete step-by-step execution:
- Given/When/Then steps
- Step execution status
- Step duration
- Step arguments and data tables
Screenshots
Visual evidence of test execution:
- Captured based on
serenity.take.screenshotsconfiguration - Default:
FOR_FAILURES(screenshots on failed scenarios) - Each step can have associated screenshots
- Click to view full-size images
Screenshot configuration is in Options:
serenity.conf:FOR_EACH_ACTION- Screenshot after every stepBEFORE_AND_AFTER_EACH_STEP- Screenshots before and after stepsAFTER_EACH_STEP- Screenshot after each stepFOR_FAILURES- Screenshots only on failureDISABLED- No screenshots
Session Information
Test execution context:
- Browser and driver details
- Test environment
- Execution timestamp
- Test duration
Tag Reports
View test execution organized by tags:- Filter by tag type (
@smoke,@regression, etc.) - See all scenarios with specific tags
- Analyze tag-based test coverage
- Track tag-level success rates
Report Configuration
Serenity report behavior is configured in multiple locations:build.gradle Configuration
testRoot- Base package for test classesrequirementsBaseDir- Location of feature filesreports- Report formats to generate (HTML, JSON, XML)
serenity.conf Configuration
Screenshot Settings
Screenshot Settings
Control when screenshots are captured:
Report Output Formats
Report Output Formats
Generate multiple report formats:
html- Interactive HTML reportsjson- Machine-readable JSON for integrationsxml- XML format for legacy tools
Project Information
Project Information
Customize report branding:This appears in report headers and titles.
Report Generation Process
Understanding how reports are built:Test Execution Data Collection
During test execution:
- Serenity listener captures test events
- Step-by-step execution data is recorded
- Screenshots are captured based on configuration
- All data is written to
target/site/serenity/in JSON format
Aggregate Task Processing
The
aggregate task:- Reads all JSON test data files
- Processes feature files for requirements
- Calculates statistics and metrics
- Generates HTML report pages
- Copies assets (CSS, JavaScript, images)
Report Plugins
The CucumberRunner configures Serenity reporting integration:SerenityReporterParallel- Thread-safe Serenity integrationpretty- Console output formatterhtml:target/cucumber-report.html- Cucumber’s native HTML report
The native Cucumber report (
target/cucumber-report.html) is separate from Serenity reports and provides a simpler, lighter-weight view of results.Living Documentation
Serenity reports serve as living documentation:Feature Documentation
Feature file descriptions appear in reports:Business Readability
Reports are designed for non-technical stakeholders:- Plain language scenario descriptions
- Visual step-by-step execution
- Screenshot evidence
- No technical jargon in scenario names
Requirements Traceability
Organize features by business capability:Report Artifacts
Archiving Reports
In CI/CD pipelines, archive the entire report directory:Publishing Reports
Serve reports from a web server:http://localhost:8000
Report Retention
Consider report retention strategy:- Keep recent builds (last 30 days)
- Archive release reports permanently
- Delete old feature branch reports
- Compress archived reports for storage
Troubleshooting Reports
No Reports Generated
Iftarget/site/serenity/ is empty:
- Verify tests executed:
./gradlew test - Check for test execution data:
ls target/site/serenity/*.json - Run aggregate manually:
./gradlew aggregate - Check build logs for errors
Incomplete Reports
If reports are missing scenarios:- Ensure all tests completed (check for build timeouts)
- Verify
gradle.startParameter.continueOnFailure = truein build.gradle - Check for exceptions in test execution
- Run
./gradlew clean test aggregatefor fresh generation
Screenshots Missing
If screenshots aren’t in reports:- Check screenshot configuration in
serenity.conf: - Verify WebDriver is properly initialized
- Ensure tests actually interact with browser
- Check for screenshot directory permissions
Report Styling Issues
If reports look broken:- Ensure complete aggregate execution (no interruptions)
- Verify
target/site/serenity/css/andtarget/site/serenity/js/exist - Check browser console for loading errors
- Try different browser (Chrome, Firefox, Safari)