You run 200 tests. 3 fail. Your manager asks: which ones failed? What was the request? What did the API return? You open the console log and scroll through 5000 lines of text. This is why you need Allure.
Allure is a reporting framework that generates beautiful HTML reports. When combined with AllureRestAssured, it automatically captures every HTTP request and response and attaches them to the test report. No extra code needed.
Remember this line from BaseTest?
requestSpec = new RequestSpecBuilder()
.setBaseUri(ConfigReader.getBaseUrl())
.setContentType(ContentType.JSON)
.addFilter(new AllureRestAssured()) // THIS LINE
.build();That single addFilter(new AllureRestAssured()) line does all the work. It is a REST Assured filter that intercepts every request and response. For each test, it captures: request method, URL, headers, body, response status, response headers, response body. All attached to the Allure report automatically.
import io.qameta.allure.*;
@Epic("Banking API")
@Feature("User Management")
public class UserTests extends BaseTest {
@Test
@Story("Create User")
@Severity(SeverityLevel.BLOCKER)
@Description("Verify that a new user can be created with valid data")
@Step("Create a user via POST /users")
public void testCreateUser() {
// test code
}
@Test
@Story("Delete User")
@Severity(SeverityLevel.CRITICAL)
@Description("Verify that a user can be deleted and no longer exists")
public void testDeleteUser() {
// test code
}
}| Annotation | Level | Purpose |
|---|---|---|
| @Epic | Project level | Top-level grouping: "Banking API", "Shopping API" |
| @Feature | Class level | Feature area: "User Management", "Payments" |
| @Story | Method level | User story: "Create User", "Login" |
| @Severity | Method level | Priority: BLOCKER, CRITICAL, NORMAL, MINOR, TRIVIAL |
| @Description | Method level | Detailed test description for the report |
| @Step | Method level | Marks a step within a test. Shows step-by-step execution. |
# Run tests — Allure results are generated in target/allure-results/
mvn test
# Generate HTML report from results
allure generate target/allure-results/ -o target/allure-report/ --clean
# Open report in browser
allure open target/allure-report/
# Shortcut — serve report directly (generates + opens)
allure serve target/allure-results/When a test fails, Allure shows the exact HTTP request that was sent and the exact response that came back. Your developer can reproduce the bug immediately — no "what was the request?" back-and-forth. This alone saves hours of debugging.
Install Allure CLI separately. It is not part of Maven. On Mac: brew install allure. On Linux: sudo apt install allure. On Windows: scoop install allure. Without the CLI, you can generate results but not view the HTML report.
Q: How do you handle reporting in your API test framework?
A: We use Allure with the AllureRestAssured filter. The filter is added once to the RequestSpec in BaseTest — it automatically captures every HTTP request and response. We annotate test classes with @Epic and @Feature, and test methods with @Story, @Severity, and @Description. After tests run, Allure generates an HTML report showing pass/fail stats, severity distribution, and for each test — the full request and response. When a test fails, the developer sees exactly what was sent and received. We also integrate Allure into our CI pipeline — the report is published as a build artifact.
Key Point: AllureRestAssured filter captures every request/response automatically. Add it once in BaseTest. Use @Epic, @Feature, @Story, @Severity annotations for organized reports.