Skip to main content
This framework uses Gradle as its build tool and test execution engine. All test operations are managed through Gradle tasks defined in build.gradle.

Core Commands

1

Run All Tests

Execute all test scenarios in the project:
./gradlew test
The test task is configured with:
  • JUnit Platform test engine
  • UTF-8 encoding for test output
  • System property forwarding from command line
  • Automatic test logging (passed, skipped, failed events)
2

Generate Reports

Aggregate test results into Serenity HTML reports:
./gradlew aggregate
This task:
  • Processes test execution data from target/site/serenity
  • Generates comprehensive HTML reports
  • Creates living documentation from feature files
  • Must run after test execution completes
3

Full Test Cycle

Run tests and generate reports in one command:
./gradlew clean test aggregate
This is the recommended workflow:
  • clean removes previous build artifacts
  • test executes all test scenarios
  • aggregate generates fresh reports
The test task is configured with finalizedBy(aggregate) in build.gradle, so running ./gradlew test automatically triggers report generation.

Passing System Properties

The test task forwards all system properties from the command line. Use the -D flag to pass configuration:
./gradlew test -Denvironment=qa
./gradlew test -Dwebdriver.driver=firefox
./gradlew test -Dserenity.take.screenshots=AFTER_EACH_STEP

Pre-configured Properties

The build.gradle sets default system properties:
systemProperty "serenity.test.root", "org.btg.practual"
systemProperty "serenity.project.name", "Makers BTG Tests"
You can override these at runtime using -D flags.

Tag Filtering

Filter which tests run using Cucumber tags through system properties:
./gradlew test -Dcucumber.filter.tags="@test"
./gradlew test -Dcucumber.filter.tags="@smoke and not @wip"
./gradlew test -Dcucumber.filter.tags="@regression or @critical"
The CucumberRunner is pre-configured with @test as the default tag filter. Override this using the -Dcucumber.filter.tags system property.

Clean Build

Remove all generated files and start fresh:
./gradlew clean
This deletes:
  • build/ directory
  • target/ directory
  • Compiled test classes
  • Test execution data
  • Previous reports

Gradle Options

Continue on Failure

The project is configured with gradle.startParameter.continueOnFailure = true, meaning test execution continues even when scenarios fail. This ensures:
  • All tests run to completion
  • Complete test coverage data is collected
  • Full reports are generated

Show Standard Streams

Test output is visible in the console:
testLogging {
    events "passed", "skipped", "failed"
    showStandardStreams = true
}
This displays:
  • Real-time test progress
  • System.out and System.err messages
  • Test event summaries

Common Workflows

Quick test execution during development:
./gradlew test -Dcucumber.filter.tags="@wip"
Run only work-in-progress scenarios without generating full reports.
Execute critical path tests:
./gradlew clean test -Dcucumber.filter.tags="@smoke"
Verify core functionality before full regression.
Complete test suite execution:
./gradlew clean test aggregate
Run all tests and generate comprehensive reports.
Target specific environment:
./gradlew test -Denvironment=qa -Dcucumber.filter.tags="@integration"
Run integration tests against QA environment.

Troubleshooting

Build Fails to Start

Ensure the Gradle wrapper is executable:
chmod +x gradlew

Java Version Issues

The project requires Java 21. Verify your Java version:
java -version
The toolchain is configured in build.gradle:
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

Tests Not Running

Verify the test task configuration:
./gradlew test --info
Check that:
  • Feature files exist in src/test/resources/features/
  • Step definitions exist in org.btg.practual.stepDefinitions
  • Tags match the filter in CucumberRunner or command line
Use --info or --debug flags for detailed Gradle execution logs:
./gradlew test --info
./gradlew test --debug

Build docs developers (and LLMs) love