End‑to‑end and API test suite for the SmartGarage application. The project mixes web UI (Selenium 4) and REST API (REST Assured 5) tests, organized with JUnit 5 and reported with Allure 2. Tests are consistently tagged so you can run only API, only UI, or everything in one command.
- Java 17, Maven
- JUnit 5 (Jupiter) with
@Tag - Selenium 4 (UI/System tests)
- REST Assured 5 (API/Integration tests)
- Allure 2 (reporting) — Maven plugin + CLI
- Gson, Lombok, Faker
- (Optional) MariaDB JDBC for DB utilities
Allure Maven & JUnit 5 are configured in the POM, including the Allure plugin and Surefire provider. Allure results are written under
target/allure-results(seesrc/test/resources/allure.properties).
src/
main/
java/
com.smartgarage.api/ # API client layer (ServicesApi, CustomerApi, VehicleApi, ClientCarsApi, …)
com.smartgarage.pages/ # Page Objects (AdminPanelPage, ServiceOverviewPage, sections/, …)
com.testframework/ # Core: DriverManager, enums (BrowserType, BrowserMode), Base* classes, RequestSpecFactory
resources/
test/
java/
api/ # API tests (e.g., users, services, vehicles, clientCars)
web/ # UI tests (pages/entities/services)
resources/
config.properties # Environment & browser settings
allure.properties # Allure output directory
Key base classes:
com.testframework.core.BaseApiTest— common REST Assured setup & Allure filter.com.testframework.core.BaseWebTest— WebDriver lifecycle and page initialization.com.testframework.core.BaseApiService&RequestSpecFactory— base URI and Basic Auth from config.
Before you start, make sure you have the following installed:
- Docker (for running the SmartGarage app + DB)
- Java 17 (runtime + compiler)
- Maven (for building the project)
- Allure CLI (for test reporting)
- Install Allure CLI (one‑time):
-
macOS (Homebrew):
brew install allure allure --version
-
Other OS options: see an Allure installation guide. (https://allurereport.org/docs/install/)
Once these are set up, you can build & run the app via Docker, run tests with Maven, and generate Allure reports for results visualization.
This repo includes the application source so you can spin it up in Docker and then run the tests against it.
/app # SmartGarage app (Docker build context)
/database # MariaDB init & Dockerfile (build context)
/setup-docker/
docker-compose.yml
The provided
docker-compose.yml(undersetup-docker/) builds the two services using relative paths../appand../database, so keep this structure exactly.
# Build & run
cd setup-docker
docker compose build
docker compose up -d
# go back to project root to run the tests
cd ..- App: http://localhost:8081
- MariaDB: localhost:3307 (container port 3306 is mapped to host 3307)
Check status and logs:
docker compose ps
docker compose logs -f app
docker compose logs -f mariadbStop & clean:
docker compose down # stop
docker compose down -v # stop + remove DB volume (fresh database)This suite uses JUnit 5 @Tag to partition tests:
- API tests →
@Tag("integration")(plus fine‑grained tags likeusers-api,services-api) - UI (Selenium) tests →
@Tag("system")
Run subsets with Maven Surefire’s groups / excludedGroups (JUnit Platform provider):
# Run ONLY API tests
mvn clean test -Dgroups=integration
# Run ONLY UI (Selenium) tests
mvn clean test -Dgroups=system
# Run both API + UI
mvn clean test -Dgroups=integration,system
# Run by a more specific tag (e.g., only Users API)
mvn clean test -Dgroups=users-api
# Exclude a tag (e.g., skip UI)
mvn clean test -DexcludedGroups=system
# Combine include/exclude
mvn clean test -Dgroups=integration -DexcludedGroups=services-apiMaven Surefire’s JUnit Platform provider maps JUnit 5 tags to the
groupsandexcludedGroupsCLI properties, and also supports tag expressions. See the official docs.
- Execute tests and open the report:
# Run ALL tests + serve Allure report
mvn clean test allure:serve
# Only API tests (integration) + Allure
mvn clean test -Dgroups=integration allure:serve
# Only UI tests (system) + Allure
mvn clean test -Dgroups=system allure:serve
# Generate static report (no temp server)
mvn clean test allure:reportAllure Maven plugin basics and goals are documented here.
Allure results are generated to
target/allure-results, andallure:servespins up a temporary web server with the HTML report.
@Epic,@Feature, (optionally@Story,@Severity, etc.) to organize the report’s Behaviors tree.
Edit src/test/resources/config.properties for environment and browser setup:
smartGarageUrl=http://localhost:8081/
adminUsername=felix_jackson
adminPassword=password123%D
browserType=CHROME # CHROME | FIREFOX | EDGE
browserMode=NORMAL # NORMAL | HEADLESS
defaultTimeoutSeconds=10- API base URL & credentials are read by
RequestSpecFactoryand applied to every API request (Basic auth, JSON content type). - Browser is configured by
DriverManagerusingbrowserTypeandbrowserMode(e.g., headless CI runs).
Java 17 and the Allure + Surefire + Compiler plugins are pinned in the POM.
# Smoke everything locally
mvn clean test
# Just API (integration)
mvn clean test -Dgroups=integration
# Just UI (system)
mvn clean test -Dgroups=system
# API + UI + open Allure
mvn clean test -Dgroups=integration,system allure:serve
# Regenerate a static Allure report after a run
mvn allure:report- No tests run / 0 tests found: verify your tag filters (e.g., did you pass
-Dgroupsthat excludes all?). - Allure report doesn’t open: ensure the Allure CLI is installed and on PATH; check that
target/allure-resultsexists after a test run. - WebDriver errors: confirm
browserType,browserMode, and that a compatible browser is installed on the machine/agent. - Wrong base URL / 401: update
smartGarageUrland credentials inconfig.properties(used byRequestSpecFactory).
Internal training project. See the repository for details.