Skip to content

DmitryGontsa/qa-automation-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AQA Test Framework (API + UI + Integration)

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

Contents


Project Highlights

✅ API layer

  • 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/*

✅ UI layer

  • 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)

✅ Integration layer

  • Example “API creates data → UI uses it”: integration/tests/*

✅ Reliability & DevEx

  • 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)

Tech Stack

  • 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

Project Structure

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

Prerequisites

  • JDK 21 (Temurin/Oracle/etc.)
  • Maven 3.8+
  • Google Chrome installed (for UI tests)
  • Internet access to reach demoqa.com and restful-booker environments

Selenide/Selenium will handle the driver automatically on most modern setups.
If your environment is restricted, you may need to configure a driver manually.


Quick Start

# 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:serve

How to Run

Run everything

mvn clean test

Run only API tests

There 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.* test

Option B — run API by tags (recommended for CI/quick checks)

mvn test -Djunit.jupiter.tags.include=smoke

Run only UI tests (by package)

mvn -Dtest=ui.tests.* test

Run only Integration tests (by package)

mvn -Dtest=integration.tests.* test

Run by JUnit 5 tags

Tags used in this repo:

  • smoke
  • regression
  • integration

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,regression

Run a single test class

mvn -Dtest=PositiveBookingTests test

Run UI in headless mode (useful for CI)

mvn test \
  -Dselenide.headless=true \
  -Dselenide.browser=chrome \
  -Dselenide.browserSize=1920x1080

Configuration

Environments for Booking API

The 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=prod

Credentials (API / BookStore)

The 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!"

UI runtime settings (Selenide)

You can tune execution via standard Selenide system properties (examples):

  • selenide.headless=true|false
  • selenide.browser=chrome
  • selenide.browserSize=1920x1080
  • selenide.timeout=5000
  • selenide.reportsFolder=target/selenide-reports

Parallel execution

Parallel execution is enabled by default via src/test/resources/junit-platform.properties.

To disable parallel run:

mvn test -Djunit.jupiter.execution.parallel.enabled=false

To limit threads (example):

mvn test \
  -Djunit.jupiter.execution.parallel.config.strategy=fixed \
  -Djunit.jupiter.execution.parallel.config.fixed.parallelism=4

Allure Reporting

Where results are stored

Raw results (JSON + attachments):

  • target/allure-results

Generate HTML report:

mvn allure:report

Open locally:

mvn allure:serve

Attachments on UI failures

When 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.


OpenAPI Client Generation

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-sources

Generated 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.


CI (GitHub Actions)

Pipeline definition:

  • .github/workflows/ci.yml

What it does:

  1. Sets up Java 21
  2. Runs tests in headless mode
  3. Uploads Allure raw results and Allure HTML report as artifacts
  4. Publishes report to GitHub Pages on main/master (non-PR runs)

Troubleshooting

UI tests fail locally (browser/driver issues)

Try:

  • Ensure Chrome is installed and up to date
  • Run headless:
    mvn test -Dselenide.headless=true
  • Force browser:
    mvn test -Dselenide.browser=chrome

“Allure command not found”

You don't need a global installation — use:

mvn allure:serve

Restful Booker env is down / unstable

Switch environment (if available):

mvn test -Denv=qa

Roadmap

Ideas for “next production steps”:

  • Add logback config 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

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages