Overview
Serenity-specific settings control test execution behavior, reporting, logging, and test organization. These settings are configured in bothserenity.conf and build.gradle.
Serenity Configuration Block
The main Serenity settings inserenity.conf:
serenity.conf
Screenshot Configuration
Controls when Serenity captures screenshots during test execution.Options:
FOR_FAILURES: Only capture screenshots when tests fail (default)BEFORE_AND_AFTER_EACH_STEP: Capture before and after every stepAFTER_EACH_STEP: Capture after every stepFOR_EACH_ACTION: Capture for every user actionDISABLED: No screenshots
Screenshot Strategy Comparison
FOR_FAILURES is recommended for most projects as it:- Minimizes test execution time
- Reduces report size
- Still provides debugging information when tests fail
Test Root Package
Specifies the root package for test classes. Serenity uses this to scan for:
- Cucumber step definitions
- Screenplay tasks and questions
- Page objects and interactions
- Custom actions
Both configurations should match to ensure consistent scanning behavior. The
build.gradle setting takes precedence during test execution.Logging Configuration
Controls the verbosity of Serenity’s console logging during test execution.Options:
QUIET: Minimal logging, only errors and critical informationNORMAL: Standard logging with test progressVERBOSE: Detailed logging including step execution
serenity.conf
QUIET mode reduces console noise, making it easier to spot actual test failures. Test details are still captured in the HTML reports.Console Colors
Enables colored console output for better readability of test results.When enabled:
- ✅ Passed tests appear in green
- ❌ Failed tests appear in red
- ⚠️ Skipped tests appear in yellow
serenity.conf
Some CI/CD systems may not support colored output. If you see color codes instead of colored text, set this to
false.Gradle Test Configuration
Additional Serenity settings inbuild.gradle:
build.gradle
System Properties
Value:
org.btg.practualRoot package for scanning test classes and step definitions.Value:
Makers BTG TestsProject name displayed in the Serenity HTML reports header.Passes all JVM system properties to the test execution.This enables runtime configuration overrides:
Test Logging Configuration
build.gradle
Specifies which test events to log to the console.
passed: Log successful test completionskipped: Log skipped testsfailed: Log test failures with stack traces
When enabled, displays standard output (System.out) and error streams (System.err) in the console during test execution.Useful for debugging but can create verbose output.
Serenity Plugin Configuration
build.gradle
Value:
org.btg.practualRoot package for test scanning (same as systemProperty).Value:
src/test/resources/featuresDirectory containing Cucumber feature files. Serenity uses this to:- Generate requirements documentation
- Link test results to feature files
- Create traceability reports
Value:
["html"]Report formats to generate after test execution.Available formats:html: Rich HTML reports with screenshots (default)json: JSON output for integration with other toolsxml: JUnit XML format
The HTML report is the primary Serenity report format, providing:
- Visual test results with screenshots
- Step-by-step execution details
- Requirements traceability
- Test execution statistics
Report Customization
Project Name and Branding
build.gradle
Custom Report Output Directory
build.gradle
Additional Report Formats
build.gradle
Gradle Continue on Failure
build.gradle
Ensures Gradle continues executing all tests even if some fail, instead of stopping at the first failure.Impact:
- All tests run to completion
- Complete test report is generated
- Build still fails if any test fails, but you see all results
This is crucial for CI/CD pipelines to get complete test coverage feedback rather than partial results.
Common Configuration Patterns
Development Mode (Verbose)
serenity.conf
CI/CD Mode (Optimized)
serenity.conf
Performance Testing Mode
serenity.conf
Troubleshooting
Reports Not Generated
Verify Serenity plugin is applied
Verify Serenity plugin is applied
Check that
build.gradle includes:Check test.finalizedBy(aggregate)
Check test.finalizedBy(aggregate)
Ensure report generation is triggered:
Look for output directory
Look for output directory
Reports are generated in
target/site/serenity/ by default.Step Definitions Not Found
Verifytest.root matches your package structure:
Large Report Files
Reduce screenshot frequency:Best Practices
Use FOR_FAILURES Screenshots
Balances debugging capability with performance
Keep Logging QUIET
Reduces console noise, details still in reports
Enable continueOnFailure
Get complete test results in CI/CD
Set Project Name
Makes reports easily identifiable