A production-style automation framework built on Java 21 + Maven + JUnit 5 that demonstrates a clean separation of concerns for:
- API testing (Rest Assured + OpenAPI generated client)
- UI testing (Selenide / Selenium)
- Bonus API layer via Playwright APIRequest (no browser required)
- Integration scenarios that combine API + UI flows
- Reporting with Allure (attachments, raw results, HTML report)
- Parallel execution enabled by default (JUnit Platform)
Targets used in this project:
- API:
https://restful-booker.herokuapp.com(switchable via-Denv=...)- UI:
https://demoqa.com
- Project Highlights
- Tech Stack
- Project Structure
- Prerequisites
- Quick Start
- How to Run
- Configuration
- Allure Reporting
- OpenAPI Client Generation
- CI (GitHub Actions)
- Troubleshooting
- Roadmap
- OpenAPI-generated type-safe client from
src/test/resources/restful-booker.yaml - Centralized API client factory with auth token caching:
config/ApiTestClient - Steps / helpers pattern for readable tests:
api/steps/*,api/helpers/* - JSON schema validation examples:
src/test/resources/schemas/*
- Page Object pattern:
ui/pages/* - Locators centralized:
ui/locators/* - Custom Selenide helpers/conditions:
ui/utils/* - Automatic Allure artifacts on failures (screenshot, page source, browser logs)
- Example “API creates data → UI uses it”:
integration/tests/*
- Parallel execution enabled by default (JUnit Platform)
- Optional retry annotation for flaky API tests:
@RetryOnFailure - GitHub Actions pipeline generating and publishing Allure report (artifact + Pages)
- Java 21, Maven
- JUnit 5 (Jupiter)
- Rest Assured
- OpenAPI Generator (Rest Assured library)
- Selenide (Selenium 4 under the hood)
- Playwright (APIRequestContext only)
- Allure (JUnit5 + RestAssured + Selenide integrations)
- AssertJ, Lombok, JavaFaker
src/test/java
├── api
│ ├── extensions # JUnit5 extensions (logging, retry, Playwright lifecycle)
│ ├── helpers # env/base URL helper
│ ├── steps # API steps (business-level actions)
│ ├── tests # API test suites (positive/negative/parallel/validation)
│ └── utils # test data generators
├── config # shared configuration & API clients
├── integration/tests # cross-layer scenarios (API + UI)
└── ui
├── base # BasePage + common setup
├── dto # data objects (builders)
├── extensions # Allure artifacts / API user lifecycle
├── locators # centralized locators
├── pages # Page Objects
└── tests # UI test suites
src/test/resources
├── allure.properties
├── junit-platform.properties
├── restful-booker.yaml # OpenAPI spec for API client generation
└── schemas # JSON schema examples
- JDK 21 (Temurin/Oracle/etc.)
- Maven 3.8+
- Google Chrome installed (for UI tests)
- Internet access to reach
demoqa.comandrestful-bookerenvironments
Selenide/Selenium will handle the driver automatically on most modern setups.
If your environment is restricted, you may need to configure a driver manually.
# 1) Install dependencies & run all tests
mvn clean test
# 2) Generate Allure report
mvn allure:report
# 3) Open report locally (starts a local server)
mvn allure:servemvn clean testThere is no dedicated @Tag("api") marker in this repository, so the most reliable way is to run API suites by their packages/test class patterns.
Option A — run a specific API suite package
# Positive scenarios
mvn -Dtest=api.tests.booking.positive.* test
# Negative scenarios
mvn -Dtest=api.tests.booking.negative.* test
# Validation & schema-focused tests
mvn -Dtest=api.tests.booking.validation.* test
# Parallel execution examples
mvn -Dtest=api.tests.booking.parallel.* test
# Bonus: Playwright APIRequest-based tests
mvn -Dtest=api.tests.bonus.* testOption B — run API by tags (recommended for CI/quick checks)
mvn test -Djunit.jupiter.tags.include=smokemvn -Dtest=ui.tests.* testmvn -Dtest=integration.tests.* testTags used in this repo:
smokeregressionintegration
Examples:
# Smoke suite
mvn test -Djunit.jupiter.tags.include=smoke
# Regression suite
mvn test -Djunit.jupiter.tags.include=regression
# Integration only
mvn test -Djunit.jupiter.tags.include=integration
# Multiple tags
mvn test -Djunit.jupiter.tags.include=smoke,regressionmvn -Dtest=PositiveBookingTests testmvn test \
-Dselenide.headless=true \
-Dselenide.browser=chrome \
-Dselenide.browserSize=1920x1080The Booking API base URL depends on env:
| env | Base URL |
|---|---|
dev (default) |
https://restful-booker.herokuapp.com |
qa |
https://restful-booker-qa.herokuapp.com |
prod |
https://restful-booker-prod.herokuapp.com |
Usage:
mvn test -Denv=dev
mvn test -Denv=qa
mvn test -Denv=prodThe framework reads credentials from System Properties first, then from Environment Variables, then falls back to defaults (training stand).
| Purpose | System property | Environment variable |
|---|---|---|
| Restful Booker username | api.username |
API_USERNAME |
| Restful Booker password | api.password |
API_PASSWORD |
| DemoQA BookStore password | bookstore.password |
BOOKSTORE_PASSWORD |
Examples:
mvn test -Dapi.username=admin -Dapi.password=password123
mvn test -Dbookstore.password="YourStrongPassword123!"You can tune execution via standard Selenide system properties (examples):
selenide.headless=true|falseselenide.browser=chromeselenide.browserSize=1920x1080selenide.timeout=5000selenide.reportsFolder=target/selenide-reports
Parallel execution is enabled by default via src/test/resources/junit-platform.properties.
To disable parallel run:
mvn test -Djunit.jupiter.execution.parallel.enabled=falseTo limit threads (example):
mvn test \
-Djunit.jupiter.execution.parallel.config.strategy=fixed \
-Djunit.jupiter.execution.parallel.config.fixed.parallelism=4Raw results (JSON + attachments):
target/allure-results
Generate HTML report:
mvn allure:reportOpen locally:
mvn allure:serveWhen a UI test fails/aborts, the framework attaches (best-effort):
- Screenshot
- Page source (HTML)
- Browser console logs
Implemented in: ui/extensions/AllureArtifactsExtension + ui/utils/AllureAttachments.
The Rest Assured client is generated from:
src/test/resources/restful-booker.yaml
Generation is configured in pom.xml via openapi-generator-maven-plugin and sources are added automatically.
If you want to regenerate manually:
mvn generate-sourcesGenerated sources location:
target/generated-sources/openapi/src/gen/java/main
Tip: after generation, re-import Maven project in your IDE to pick up generated sources.
Pipeline definition:
.github/workflows/ci.yml
What it does:
- Sets up Java 21
- Runs tests in headless mode
- Uploads Allure raw results and Allure HTML report as artifacts
- Publishes report to GitHub Pages on
main/master(non-PR runs)
Try:
- Ensure Chrome is installed and up to date
- Run headless:
mvn test -Dselenide.headless=true - Force browser:
mvn test -Dselenide.browser=chrome
You don't need a global installation — use:
mvn allure:serveSwitch environment (if available):
mvn test -Denv=qaIdeas for “next production steps”:
- Add
logbackconfig and structured logging for API + UI - Introduce Maven profiles (
api,ui,integration) for easier launches - Add Dockerized execution (Chrome in container, GitHub Actions parity)
- Add contract tests and stricter schema/versioning for the OpenAPI spec
- Add flaky test quarantine + rerun strategy at suite level