Automated API test framework for the FakeRestAPI Online Bookstore (https://fakerestapi.azurewebsites.net), covering the Books endpoints (required) and Authors endpoints (bonus).
Built with Java 17 · Maven · RestAssured · TestNG · Allure, with a ready-to-run GitHub Actions CI pipeline that produces and publishes test reports.
- Clean, layered architecture (models → clients → tests) that promotes reuse and maintainability.
- Shared request/response specifications, centralised configuration, and a Jackson-based (de)serialization setup.
- Fluent builders and a
TestDataFactoryfor independent, repeatable test data. - Happy-path and edge-case coverage (non-existent ids, malformed ids, malformed/empty bodies, boundary values), including data-driven tests.
- Rich Allure reports with steps, severities, and request/response attachments.
- CI pipeline that runs the suite and uploads Allure + Surefire reports on every push/PR.
allwyn/
├── pom.xml # Build, dependencies, plugins
├── testng.xml # Suite definition (Books + Authors)
├── .github/workflows/ci.yml # CI/CD pipeline
└── src/test/
├── java/com/allwyn/bookstore/
│ ├── base/ # BaseTest, Jackson mapper provider
│ ├── clients/ # BooksClient, AuthorsClient (endpoint wrappers)
│ ├── config/ # ConfigManager (layered configuration)
│ ├── models/ # Book, Author POJOs (with builders)
│ ├── specs/ # Shared RestAssured request/response specs
│ ├── utils/ # TestDataFactory
│ └── tests/
│ ├── books/ # BooksCrudTests, BooksEdgeCaseTests
│ └── authors/ # AuthorsCrudTests, AuthorsEdgeCaseTests
└── resources/
├── config.properties # Base URL, timeouts, logging
└── allure.properties # Allure results directory
- Clients wrap each endpoint and return the raw
Response, keeping assertions in the tests where they belong (single responsibility). ApiSpecsbuilds one consistent request spec (base URI, headers, timeouts, Allure filter) so tests never repeat transport setup (DRY).ConfigManagerresolves each value as system property → environment variable →config.properties, so the same code runs locally and in CI without edits (open/closed to new environments).- FakeRestAPI is a stateless mock — it echoes payloads but does not truly persist them. Assertions verify the contract (status codes, echoed fields, response shape), not cross-request persistence.
- JDK 17+ (
java -version) - Maven 3.9+ (
mvn -version) - Internet access to reach the FakeRestAPI host
Allure command-line is not required — the report is generated via the Allure Maven plugin.
# From the project root (the folder containing pom.xml)
mvn clean testRun a single suite / class / method:
# Only the Authors tests via a custom suite file
mvn clean test -DsuiteXmlFile=testng.xml
# A single test class
mvn clean test -Dtest=BooksCrudTests
# A single test method
mvn clean test -Dtest=BooksCrudTests#getAllBooks_returnsNonEmptyListAny key in config.properties can be overridden without editing files:
# System property
mvn clean test -Dbase.uri=https://fakerestapi.azurewebsites.net -Dlog.all=true
# Or environment variable (dots -> underscores, upper-cased)
# BASE_URI, BASE_PATH, LOG_ALL, HTTP_SOCKET_TIMEOUT_MS ...Generate and open the HTML report locally after a test run:
# Generate the static report into target/site/allure-maven-plugin
mvn io.qameta.allure:allure-maven:report
# Or generate + open in a browser
mvn io.qameta.allure:allure-maven:serveRaw results are written to target/allure-results; the HTML report to target/site/allure-maven-plugin.
Plain TestNG/Surefire results are also available under target/surefire-reports.
| Area | Class | Coverage |
|---|---|---|
| Books – happy path | BooksCrudTests |
GET all, GET by id, POST, PUT, DELETE, create→get |
| Books – edge cases | BooksEdgeCaseTests |
non-existent ids (404), malformed ids (400), malformed/empty body, boundary values |
| Authors – happy path | AuthorsCrudTests |
GET all, GET by id, POST, PUT, DELETE |
| Authors – edge cases | AuthorsEdgeCaseTests |
non-existent ids (404), malformed ids (400), no 5xx leakage |
The workflow at .github/workflows/ci.yml runs on every push/PR to main/master (and manual dispatch):
- Sets up JDK 17 (with Maven dependency caching).
- Runs
mvn clean test. - Always generates the Allure HTML report and uploads it, the raw Allure results, and the Surefire reports as build artifacts (downloadable from the run's Artifacts section).
- On
main, optionally publishes the Allure report to GitHub Pages under/allure.
Because report steps use if: always(), you always get a report even when tests fail — while real test failures still fail the job so CI gates correctly. For a report-only run that must not fail the build, pass -DtestFailureIgnore=true.
| Concern | Choice |
|---|---|
| Language | Java 17 |
| Build | Maven |
| HTTP / assertions | RestAssured + Hamcrest |
| Test runner | TestNG (parallel by class) |
| JSON | Jackson |
| Reporting | Allure |
| CI | GitHub Actions |