Portfolio · Case study · API test automation
Catch API bugs before a single screen is built.
We built a Java API test suite with REST Assured that covers authentication, data validation and negative cases. Reusable request builders keep tests short and consistent, and the whole suite runs in CI on every change, so defects are found at the API layer, where they are fastest and cheapest to fix.
- Client
- Dental practice software company
- Service
- API test automation framework
- Stack
- Java · REST Assured · TestNG
- Timeline
- 6 months
The challenge
Bugs were found late, through the UI.
Most testing happened through the user interface, so API defects only appeared once screens were built. By then, a broken validation rule or a security gap was slow to trace and expensive to fix.
UI tests were also slow and brittle, and they rarely tried the unhappy paths: missing fields, wrong data types, expired tokens or users reaching data that wasn’t theirs.
Our solution
Test the API directly, thoroughly and early.
- API-first testing: every endpoint is tested as soon as it exists, with or without a UI.
- Negative cases by design: invalid, missing and malicious inputs are tested as carefully as the happy path.
- Reusable request builders: auth, headers and payloads defined once, so new tests take minutes to write.
- Runs in CI: the suite gates every merge, with clear reports for the whole team.
Test coverage
Four layers of API confidence
Each endpoint is checked for who can call it, what it accepts, what it returns and how it fails.
Who can call it?
- Valid, expired and malformed tokens
- Role-based access per endpoint
- Users blocked from other users’ data
What does it accept?
- Required fields, types and formats
- Boundary values and length limits
- Business rules on the request body
What does it return?
- JSON schema checks on every response
- Correct status codes and headers
- Field values matched to expectations
How does it fail?
- Missing, null and wrong-type fields
- Unknown IDs and duplicate records
- Clear, safe error messages
Example negative-case matrix
| Scenario | Request | Expected |
|---|---|---|
| No token | Authorization header missing | 401 |
| Wrong role | Standard user calls an admin endpoint | 403 |
| Missing field | Required email left out | 400 + field error |
| Invalid format | Date sent as free text | 400 + field error |
| Unknown resource | ID that doesn’t exist | 404 |
| Duplicate record | Same record created twice | 409 |
Inside the framework
Write once, reuse everywhere
Reusable request builders hold the base URL, authentication and headers. Each test only describes what is unique about it, so tests stay short, readable and easy to maintain as the API grows.
public class RequestBuilder {
public static RequestSpecification
authorised(String role) {
return new RequestSpecBuilder()
.setBaseUri(Config.baseUrl())
.setContentType(ContentType.JSON)
.addHeader("Authorization",
"Bearer " + Tokens.forRole(role))
.addFilter(new AllureRestAssured())
.build();
}
}@Test
public void createUser_missingEmail_returns400() {
User user = UserFactory.valid()
.withEmail(null);
given()
.spec(RequestBuilder.authorised("admin"))
.body(user)
.when()
.post("/users")
.then()
.statusCode(400)
.body("errors.field", hasItem("email"));
}Layered structure
Builders, API clients, data models and tests kept in separate layers.
Test data factories
Valid and invalid payloads generated on demand, no hard-coded data.
Multi-environment
The same suite runs against dev, test and staging through config.
Readable reports
Every request and response logged in the report for fast debugging.
Why API-first
Test where bugs are cheapest to fix
API tests run in seconds, don’t break when a button moves, and can reach edge cases the UI never exposes. By testing the API layer thoroughly, UI tests only need to cover the key user journeys.
The result is a faster, more stable test pyramid, and developers who hear about a bug minutes after writing it, not weeks later.
Tech stack
Tools we used
Language & build
Java, Maven
API testing
REST Assured, JSON Schema Validator
Test runner
TestNG with data providers for parameterised cases
Data & models
POJOs with Jackson, test data factories
Reporting
Allure reports with request/response logs
CI/CD
Azure DevOps Pipelines, gating every merge
Outcomes
What changed for the team
automated API test cases
endpoints covered
for a full regression run in CI
defects caught before UI testing began
“Before NexaQore, most of our API bugs surfaced during UI testing, weeks after the code was written. Now more than 500 automated tests run in Azure DevOps on every change, and our developers hear about a broken validation rule or an access issue within minutes. The request builders make new tests quick to add, so coverage keeps growing with the product. It’s changed how confidently we release.”
Finding API bugs too late?
We build API test frameworks that catch defects early and keep catching them on every change.