/quality-skills:rest-assuredfrom quality-skills
Designs, implements, debugs, and scales REST Assured tests for Java/JVM API testing. Covers fluent DSL, JSON/XML path assertions, schema validation, auth, logging, and reusable specs.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in REST Assured for Java/Kotlin/Groovy API testing. Your goal is to help engineers design readable, maintainable REST Assured tests — specs, JSON path assertions, schema validation, auth, logging — without fabricating method signatures, Maven coordinates, or matcher names. When uncertain, point the reader to rest-assured.io.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
MockMvc (in-process), or Spring's own WebTestClient. Each has different speed/realism trade-offs.If the file does not exist, ask: JVM language, build tool, test runner, Spring or not, target environment (local server, staging, mocked).
given().when().then() reads like a spec.RequestSpecification and ResponseSpecification encode common headers, auth, and assertions.When not to use REST Assured:
import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
@Test
void getUserReturnsExpectedShape() {
given()
.baseUri("https://api.example.com")
.auth().oauth2("bearer-token-placeholder")
.header("Accept", "application/json")
.when()
.get("/users/{id}", "user-42")
.then()
.statusCode(200)
.contentType("application/json")
.body("id", equalTo("user-42"))
.body("email", endsWith("@example.com"))
.body("roles", hasItems("user"));
}
given() sets up the request, when() issues it, then() runs assertions. Multiple .body(jsonPath, matcher) calls assert independently.
JsonPath in REST Assured uses Groovy-style dot notation (not full JSONPath like $.foo[0]):
.body("data.users[0].id", equalTo("user-42"))
.body("data.users.size()", equalTo(3))
.body("data.users.findAll { it.active == true }.size()", greaterThanOrEqualTo(1))
.body("data.users*.email", everyItem(endsWith("@example.com")))
Groovy collection operators (findAll, collect, *.) work inside path strings. If you need pure JSONPath ($.data.users[*].id), use JsonPath from JayWay separately, or body(JsonPath.from(...).get(...)).
.then()
.body(matchesJsonSchemaInClasspath("schemas/user.schema.json"));
Add the json-schema-validator module dependency. Keep schema files under src/test/resources/schemas/. For OpenAPI-derived schemas, generate per-endpoint schemas with a tool rather than hand-writing.
Avoid copy-pasting baseUri and auth across 200 tests. Define a RequestSpecification once:
public class Specs {
public static RequestSpecification authedJson(String token) {
return new RequestSpecBuilder()
.setBaseUri("https://api.example.com")
.setAuth(oauth2(token))
.setContentType(ContentType.JSON)
.addHeader("X-Client", "qa-suite")
.build();
}
public static ResponseSpecification okJson() {
return new ResponseSpecBuilder()
.expectStatusCode(200)
.expectContentType(ContentType.JSON)
.build();
}
}
Tests then read clean:
given().spec(Specs.authedJson(token))
.when().get("/users/{id}", id)
.then().spec(Specs.okJson()).body("id", equalTo(id));
given()
.spec(Specs.authedJson(token))
.body(Map.of("email", "[email protected]", "role", "viewer"))
.when()
.post("/users")
.then()
.statusCode(201)
.body("id", notNullValue());
.body(Object) serializes via Jackson (if on classpath) for POJOs and Maps. For raw strings, pass a string literal; for files, new File("...").
String userId = given().spec(Specs.authedJson(token))
.body(Map.of("email", "[email protected]"))
.when().post("/users")
.then().statusCode(201)
.extract().path("id");
given().spec(Specs.authedJson(token))
.when().delete("/users/{id}", userId)
.then().statusCode(204);
Or extract the whole response:
Response r = given().when().get("/users").then().extract().response();
List<String> ids = r.jsonPath().getList("data.users.id");
REST Assured has shortcuts for common schemes:
| Method | Use |
|---|---|
.auth().basic(user, pass) | HTTP Basic |
.auth().preemptive().basic(user, pass) | Sends auth without waiting for 401 challenge |
.auth().oauth2(token) | Bearer token |
.auth().digest(...) | HTTP Digest |
.header("Authorization", "Bearer " + token) | Manual fallback |
.relaxedHTTPSValidation() | Skip TLS verification — staging only, never prod |
For complex auth (mTLS, refresh flows), set up an AuthenticationScheme or do a setup call in a @BeforeEach and cache the token.
given().log().all() // log full request
.when().get("/users/42")
.then().log().ifValidationFails(); // log response only on failure
log().ifValidationFails() is the default-in-CI pattern — minimal noise on success, full detail on failure.
For request/response logging, integrate with SLF4J via RestAssuredConfig or the LogConfig.
For Spring apps, rest-assured-spring-mock-mvc skips the network stack entirely:
@Autowired MockMvc mockMvc;
@BeforeEach
void setUp() { RestAssuredMockMvc.mockMvc(mockMvc); }
@Test
void getUser() {
given().when().get("/users/{id}", "user-42")
.then().statusCode(200);
}
Much faster than running against a real port; loses the network/serialization layer realism. Pair with a few real-HTTP integration tests.
RestAssuredConfig)RestAssured.config = RestAssuredConfig.config()
.objectMapperConfig(objectMapperConfig().jackson2ObjectMapperFactory((type, charset) -> sharedMapper))
.logConfig(logConfig().enableLoggingOfRequestAndResponseIfValidationFails())
.httpClient(httpClientConfig().setParam("http.connection.timeout", 10_000));
Set defaults once in a JUnit extension or @BeforeAll.
RequestSpecification.extract() and re-issuing the same request — extract once and chain.body(...) uses Groovy. If you want JSONPath, use it explicitly.relaxedHTTPSValidation() in production — only acceptable for self-signed staging.ResponseSpecBuilder — leads to copy-pasted .statusCode(200).contentType("application/json") everywhere.ifValidationFails().When helping with REST Assured, ask:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
rest-assured, api-testing, java-testing, integration-testing
npx claudepluginhub aks-builds/quality-skills --plugin quality-skills56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio./artilleryWhen the user wants to design, implement, debug, or operate Artillery load tests. Use when the user mentions "Artillery," "artillery.yml," "artillery run," "Artillery scenarios," "Artillery Pro," "phases (Artillery)," "Artillery plugins," "Artillery Engine," or "artillery report." For JS-tested perf with thresholds see k6. For JVM perf see gatling. For Python see locust. For JMeter see jmeter./bdd-anti-patternsWhen the user wants to audit, refactor, or rescue a Cucumber / Gherkin / SpecFlow / Reqnroll / behave BDD suite from common failure modes. Use when the user mentions "BDD anti-patterns," "Gherkin anti-patterns," "scenario refactoring," "imperative steps," "feature file review," "BDD smells," "BDD failing," "Cucumber feedback loop," "scenarios as scripts," or "is BDD worth it." For Cucumber/Gherkin basics see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For Python BDD see behave./behaveWhen the user wants to design, implement, debug, or operate BDD tests on Python using behave. Use when the user mentions "behave," "behave.ini," "@given/@when/@then," "context.x," "environment.py," "behave hooks," "behave tags," "step definitions in Python," "behave-django," or "behave-pytest." For language-agnostic Gherkin patterns see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For BDD failure modes see bdd-anti-patterns. For non-BDD Python testing see pytest.