How serenity-bdd/serenity-cucumber-starter works
Main Components
• Test Runner & Framework Integration: Represent the CucumberTestSuite (the JUnit test runner in src/test/java/starter) which ties Serenity’s reporting and lifecycle hooks to the tests. Also note that both Maven (pom.xml) and Gradle (build.gradle, gradlew, etc.) build scripts are present.
• Feature Files & Gherkin Scenarios: Show the Cucumber feature files (located in src/test/resources/features) which define the test scenarios in Gherkin.
• Step Definitions & Glue Code: Highlight the step definition classes (e.g., SearchStepDefinitions and ParameterDefinitions) which map Gherkin steps to Java methods.
• Serenity Infrastructure: Indicate the Serenity configuration files (serenity.properties, serenity.conf) that manage WebDriver setup, environment-specific URLs, and other testing options. Also note that Serenity integrates WebDriverManager to handle browser drivers.
• Reporting & CI/CD: Show the CI workflows from the .github/workflows folder (gradle.yml, maven.yml, living-documentation.yml) and the reporting components. This explains how test results are aggregated into Serenity reports (target/site/serenity).
Relationships and Interactions
• Then, branch out from the Step Definitions into two potential implementation paths:
• For Screenplay Pattern: Show actors (like “Sergey”) that perform Tasks. Link these tasks to classes such as NavigateTo and LookForInformation, and then to Page Objects (e.g., WikipediaHomePage, SearchForm).
• For Action Classes: Show the direct call chain from step definitions to methods on step classes (annotated with @Steps), like NavigateTo, SearchFor, and SearchResult, again linking to Page Objects.
• That both approaches interact with the WebDriver and Selenium APIs (possibly labeled “Serenity WebDriver API”) to locate and manipulate UI elements.
• Lastly, show a connection from the test execution flow to the reporting engine (serenity-maven-plugin or reporting mechanism integrated in Gradle) that generates living documentation and test reports.
Architectural Patterns & Design Principles
• Mention the use of the Single Responsibility Principle, which is emphasized by having multiple small classes (each with a clear role, whether a step definition, task, or page object).
• Separation between the test runner, the glue code (step definitions), and the helper libraries (tasks and page objects).
• If appropriate, mark the two parallel design implementations (Screenplay versus Action Classes) so a reader can quickly understand the architectural alternatives provided in the project.
Relevant Technologies and Frameworks
• Serenity BDD
• Cucumber (for Gherkin support)
• Selenium WebDriver (via Serenity’s wrapper)
• WebDriverManager (for binary management)
• Build tools: Maven and Gradle
• CI/CD configuration via GitHub Actions (workflow files)