π Wire Telemetry, Executable Documentation & Failure Root-Cause Diagnostics
In enterprise API test automation, plain-text console dumps and raw XML test results generated by Maven or TestNG fail to communicate testing health to stakeholders and demand tedious log scraping when triaging test failures. When an assertion breaks in CI/CD, engineers require instant, visual access to the exact outbound HTTP request (headers, query parameters, payloads) and the inbound response body without polluting the console. Allure Report is an industry-standard, lightweight multi-language reporting framework that transforms test executions into rich, interactive HTML dashboards. By integrating allure-testng and attaching the official AllureRestAssured filter directly to REST Assured specifications, every wire exchange is captured automatically as structured, expandable HTML attachments. Layered with declarative metadataβsuch as @Epic, @Feature, @Story, @Severity, and @Stepβautomation suites generate living, audit-ready API documentation with single-click triage capabilities.
ALLURE REPORT TELEMETRY GENERATION & ARTIFACT COMPILATION PIPELINE:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REST ASSURED HTTP EXECUTION PHASE β
β given().filter(new AllureRestAssured()).body(payload).when().post("/students").then()... β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ (Intercepted by AllureRestAssured Filter)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ALLURE REST ASSURED WIRE ATTACHMENT INTERCEPTOR β
β βββ 1. Request Interception: Captures Method, URL, Sanitized Headers, Cookies & JSON Body β
β βββ 2. Response Interception: Captures Status Code, Response Headers & Formatted Entity Body β
β βββ 3. File Generator: Streams attachments as text/html and application/json artifacts β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ (TestNG Test Execution Complete)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RAW TEST TELEMETRY DATA: target/allure-results/ β
β βββ *-result.json (Test case metadata, @Epic, @Feature, @Story, execution status, steps) β
β βββ *-attachment.html (Rendered HTTP request packet tab with headers & formatted payload) β
β βββ *-attachment.html (Rendered HTTP response packet tab with status code & payload) β
β βββ environment.properties (OS, Java version, Base API URL, Target Stage) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ (Compiled via 'allure serve' or Allure CLI / CI Plugin)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INTERACTIVE VISUAL DASHBOARD: target/allure-report/ (index.html) β
β βββ Overview Dashboard: Pass/Fail Ratios, Execution Trends & Severity Breakdown β
β βββ Behaviors View: Categorized by @Epic β @Feature β @Story hierarchies β
β βββ Suited View: Test classes, methods, execution timings, and @Step timelines β
β βββ Single-Click Wire Inspection: Expandable HTTP request & response payloads with syntax UI β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
allure-testng, allure-rest-assured, configuring the AspectJ Weaver javaagent inside maven-surefire-plugin, and adding allure-maven.
<!-- ==============================================================================
MAVEN POM.XML: ALLURE REPORT & REST ASSURED CONFIGURATION
============================================================================== -->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<allure.version>2.25.0</allure.version>
<aspectj.version>1.9.21</aspectj.version>
</properties>
<dependencies>
<!-- Allure TestNG Adapter -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
<!-- Allure REST Assured Automatic Wire Interceptor Filter -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-rest-assured</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven Surefire Plugin with AspectJ Weaver Agent -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<systemPropertyVariables>
<allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- Allure Maven Plugin for CLI Report Generation -->
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.12.0</version>
<configuration>
<reportVersion>${allure.version}</reportVersion>
</configuration>
</plugin>
</plugins>
</build>
AllureRestAssured filter directly into REST Assured specifications. Demonstrates automatic capture of HTTP request lines, headers, parameters, response codes, and bodies as interactive report attachments.
package com.nikita.restassured.allure;
import io.qameta.allure.restassured.AllureRestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
public class BasicAllureFilterTest {
private static final String BASE_URI = "https://staging-api.nikita-infotech.com/v1";
private RequestSpecification allureSpec;
@BeforeClass
public void setupAllureSpecification() {
// Instantiate and customize AllureRestAssured filter:
AllureRestAssured allureFilter = new AllureRestAssured()
.setRequestTemplate("http-request.ftl") // Optional custom FreeMarker template
.setResponseTemplate("http-response.ftl"); // Optional custom FreeMarker template
allureSpec = new RequestSpecBuilder()
.setBaseUri(BASE_URI)
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
// Attach AllureRestAssured filter: Intercepts all traffic automatically!
.addFilter(allureFilter)
.build();
System.out.println("[*] AllureRestAssured wire capture filter attached to specification.");
}
@Test(description = "Verify AllureRestAssured intercepts outbound POST request and inbound response")
public void testStudentCreationWithAllureCapture() {
Map<String, Object> requestPayload = new HashMap<>();
requestPayload.put("studentId", "STU-88219");
requestPayload.put("fullName", "Nikita Sharma");
requestPayload.put("academicTrack", "ENTERPRISE_AUTOMATION");
requestPayload.put("enrolledCredits", 16);
given()
.spec(allureSpec)
.body(requestPayload)
.when()
.post("/students")
.then()
.statusCode(201)
.body("status", equalTo("SUCCESS"))
.body("data.id", equalTo("STU-88219"));
System.out.println("[β] Request executed. Wire transaction automatically attached to Allure results.");
}
}
@Epic (Academic Services), @Feature (Student Onboarding), @Story (Credit Validation), and assigns @Severity levels for prioritization.
package com.nikita.restassured.allure;
import io.qameta.allure.*;
import io.qameta.allure.restassured.AllureRestAssured;
import io.restassured.http.ContentType;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
@Epic("Academic Platform Management")
@Feature("Student Registration & Onboarding")
public class CategorizedMetadataTest {
private static final String BASE_URI = "https://staging-api.nikita-infotech.com/v1";
@Test(description = "Verify student registration with standard 16 credit workload")
@Story("Candidate Enrolls in Enterprise Automation Track")
@Severity(SeverityLevel.BLOCKER)
@Description("Ensures that valid student entities receive HTTP 201 and active profile status.")
@Owner("Nikita Sharma")
@Link(name = "API-SPEC-401", url = "https://wiki.nikita-infotech.com/display/API/StudentRegistration")
@Issue("JIRA-88219")
@TmsLink("TEST-CASE-1042")
public void testStandardRegistrationScenario() {
Map<String, Object> payload = new HashMap<>();
payload.put("studentId", "STU-88219");
payload.put("fullName", "Nikita Sharma");
payload.put("academicTrack", "ENTERPRISE_AUTOMATION");
payload.put("enrolledCredits", 16);
given()
.baseUri(BASE_URI)
.contentType(ContentType.JSON)
.filter(new AllureRestAssured())
.body(payload)
.when()
.post("/students")
.then()
.statusCode(201)
.body("status", equalTo("SUCCESS"));
System.out.println("[β] Blocker severity test executed with complete business metadata mapping.");
}
@Test(description = "Verify registration rejection when credits fall below minimum allowed")
@Story("Credit Boundary Validations")
@Severity(SeverityLevel.CRITICAL)
@Description("Validates that student registration with 0 credits is rejected with HTTP 422.")
@Owner("Nikita Sharma")
public void testRejectZeroCreditsScenario() {
Map<String, Object> payload = new HashMap<>();
payload.put("studentId", "STU-88220");
payload.put("fullName", "Aarav Deshmukh");
payload.put("enrolledCredits", 0);
given()
.baseUri(BASE_URI)
.contentType(ContentType.JSON)
.filter(new AllureRestAssured())
.body(payload)
.when()
.post("/students")
.then()
.statusCode(422)
.body("error", equalTo("CREDITS_BELOW_MINIMUM"));
System.out.println("[β] Critical severity boundary test executed.");
}
}
@Step. Demonstrates parameter reflection in step titles (e.g. @Step("Fetch student record for ID: {studentId}")) to produce readable execution timelines.
package com.nikita.restassured.allure;
import io.qameta.allure.Step;
import io.qameta.allure.restassured.AllureRestAssured;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
public class GranularStepWorkflowTest {
private static final String BASE_URI = "https://staging-api.nikita-infotech.com/v1";
@Step("Step 1: Register new candidate '{fullName}' with ID '{studentId}'")
public Response registerCandidateStep(String studentId, String fullName, int credits) {
Map<String, Object> payload = new HashMap<>();
payload.put("studentId", studentId);
payload.put("fullName", fullName);
payload.put("enrolledCredits", credits);
return given()
.baseUri(BASE_URI)
.contentType(ContentType.JSON)
.filter(new AllureRestAssured())
.body(payload)
.when()
.post("/students")
.then()
.statusCode(201)
.extract().response();
}
@Step("Step 2: Fetch student profile from API for ID '{studentId}'")
public Response fetchStudentProfileStep(String studentId) {
return given()
.baseUri(BASE_URI)
.filter(new AllureRestAssured())
.pathParam("id", studentId)
.when()
.get("/students/{id}")
.then()
.statusCode(200)
.extract().response();
}
@Step("Step 3: Validate database reconciliation: Verify name is '{expectedName}' and credits are '{expectedCredits}'")
public void verifyStudentAttributesStep(Response response, String expectedName, int expectedCredits) {
Assert.assertEquals(response.path("data.fullName"), expectedName, "Full name mismatch!");
Assert.assertEquals((int) response.path("data.enrolledCredits"), expectedCredits, "Credits mismatch!");
}
@Test(description = "Verify complete student onboarding workflow with discrete @Step tracking")
public void testStudentOnboardingStepByStep() {
String studentId = "STU-88219";
String candidateName = "Nikita Sharma";
int credits = 16;
// Step 1: Registration
registerCandidateStep(studentId, candidateName, credits);
// Step 2: Query Profile
Response profileResponse = fetchStudentProfileStep(studentId);
// Step 3: Verify Details
verifyStudentAttributesStep(profileResponse, candidateName, credits);
System.out.println("[β] Multi-step workflow executed cleanly with full Allure step breakdowns.");
}
}
@Attachment method annotations and programmatic Allure.addAttachment() to embed raw JSON files, database query logs, CSV snippets, and execution traces into test results.
package com.nikita.restassured.allure;
import io.qameta.allure.Allure;
import io.qameta.allure.Attachment;
import io.restassured.http.ContentType;
import org.testng.annotations.Test;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import static io.restassured.RestAssured.given;
public class CustomAttachmentsTest {
private static final String BASE_URI = "https://staging-api.nikita-infotech.com/v1";
// 1. Declarative attachment via @Attachment method annotation
@Attachment(value = "SQL Query Audit Log", type = "text/plain")
public String attachSqlQueryLog(String query, int rowsAffected) {
return String.format("QUERY EXECUTED: %s%nROWS AFFECTED : %d%nTIMESTAMP : %s",
query, rowsAffected, java.time.Instant.now());
}
@Attachment(value = "Candidate Enrollment Contract", type = "application/json")
public String attachJsonContract(String rawJson) {
return rawJson;
}
@Test(description = "Verify programmatic and declarative custom attachments in Allure report")
public void testAttachDiagnosticArtifacts() {
String payload = "{\"studentId\": \"STU-88219\", \"track\": \"ENTERPRISE_AUTOMATION\"}";
// Attach raw contract to report
attachJsonContract(payload);
// Execute API call
given()
.baseUri(BASE_URI)
.contentType(ContentType.JSON)
.body(payload)
.when()
.post("/students")
.then()
.statusCode(201);
// Attach database audit record declaratively:
attachSqlQueryLog("INSERT INTO students (id, track) VALUES ('STU-88219', 'ENTERPRISE_AUTOMATION')", 1);
// 2. Programmatic attachment using Allure.addAttachment()
String csvDiagnosticData = "studentId,credits,status\nSTU-88219,16,ACTIVE\nSTU-88220,12,ACTIVE";
Allure.addAttachment("Reconciliation CSV Snapshot", "text/csv",
new ByteArrayInputStream(csvDiagnosticData.getBytes(StandardCharsets.UTF_8)), ".csv");
System.out.println("[β] Custom JSON contract, SQL audit log, and CSV snapshot attached to Allure.");
}
}
environment.properties file inside target/allure-results/ to display operating system, Java version, target API base URL, and build numbers.
package com.nikita.restassured.allure;
import org.testng.annotations.BeforeSuite;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
public class AllureEnvironmentManager {
@BeforeSuite(alwaysRun = true)
public void generateAllureEnvironmentMetadata() {
Properties properties = new Properties();
// System & Runtime Information
properties.setProperty("Operating System", System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ")");
properties.setProperty("Java Runtime", System.getProperty("java.version") + " (" + System.getProperty("java.vendor") + ")");
properties.setProperty("Execution Framework", "REST Assured 5.4.0 + TestNG 7.9.0");
// Target API Environment Variables
String targetEnv = System.getProperty("env", "staging").toUpperCase();
properties.setProperty("Target Stage", targetEnv);
properties.setProperty("API Base URL", System.getProperty("api.base.url", "https://staging-api.nikita-infotech.com"));
properties.setProperty("Auth Server", "https://auth.nikita-infotech.com");
properties.setProperty("Tenant Region", "MH-PUNE-WEST");
properties.setProperty("CI Build Number", System.getProperty("build.number", "BUILD-LOCAL-2026.1"));
File allureResultsDir = new File("target/allure-results");
if (!allureResultsDir.exists()) {
allureResultsDir.mkdirs();
}
File envFile = new File(allureResultsDir, "environment.properties");
try (FileOutputStream fos = new FileOutputStream(envFile)) {
properties.store(fos, "Allure Report Environment Metadata");
System.out.println("[*] Injected environment metadata into: " + envFile.getAbsolutePath());
} catch (IOException e) {
System.err.println("[!] Failed to write Allure environment.properties: " + e.getMessage());
}
}
}
AllureRestAssured inside a shared RequestSpecFactory so all inheriting service clients and test methods capture wire interactions automatically.
package com.nikita.restassured.allure;
import io.qameta.allure.restassured.AllureRestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;
import org.testng.annotations.Test;
import java.util.UUID;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
public class GlobalAllureSpecFactory {
/**
* Factory method creating pre-configured specification with embedded Allure wire capture
*/
public static RequestSpecification getEnterpriseAllureSpec() {
return new RequestSpecBuilder()
.setBaseUri("https://staging-api.nikita-infotech.com")
.setBasePath("/v1")
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.addHeader("X-Correlation-Id", "TRACE-" + UUID.randomUUID().toString().substring(0, 8))
// Universal wire logging attached to all requests:
.addFilter(new AllureRestAssured())
.build();
}
@Test(description = "Verify test execution using globally configured Allure specification")
public void testEndpointWithGlobalAllureSpec() {
given()
// Inherits base URI, JSON headers, tracing ID, and Allure filter:
.spec(getEnterpriseAllureSpec())
.pathParam("studentId", "STU-88219")
.when()
.get("/students/{studentId}")
.then()
.statusCode(200)
.body("status", equalTo("SUCCESS"));
System.out.println("[β] Verified endpoint using global Allure specification.");
}
}
allure-results folders, fixing missing wire attachments caused by forgotten AspectJ agents, and resolving broken report rendering with allure open.
package com.nikita.restassured.allure;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File;
public class AllureTriageTest {
// ==========================================================================
// PITFALL 1: EMPTY ALLURE REPORT OR MISSING @STEP / @ATTACHMENT BREAKDOWN
// Symptom: Allure report displays test names, but steps and attachments are empty.
//
// CAUSE: The AspectJ Weaver Java agent was not loaded during JVM execution!
// FIX: Verify maven-surefire-plugin contains the -javaagent:aspectjweaver argument.
//
// CLI VERIFICATION: Ensure the surefire execution output logs:
// [INFO] Running com.nikita.restassured.tests...
// Java VM started with -javaagent:.../aspectjweaver-1.9.21.jar
// ==========================================================================
@Test(description = "Verify allure-results directory is created and populated with result artifacts")
public void testVerifyAllureResultsDirectory() {
File resultsDir = new File("target/allure-results");
Assert.assertTrue(resultsDir.exists(), "target/allure-results directory must exist!");
File[] resultFiles = resultsDir.listFiles((dir, name) -> name.endsWith("-result.json"));
Assert.assertNotNull(resultFiles, "Result files list must not be null!");
System.out.println("[*] Total Allure result JSON artifacts verified: " + resultFiles.length);
Assert.assertTrue(resultFiles.length > 0, "Allure must generate at least one -result.json file!");
}
// ==========================================================================
// PITFALL 2: OPENING index.html DIRECTLY IN BROWSER SHOWS "NaN% LOADING..."
// Cause: Modern browsers block local file:// fetch/CORS requests for JSON assets.
// FIX: Always render reports using the Allure CLI server:
// $ allure serve target/allure-results
// OR generate static bundle:
// $ allure generate target/allure-results --clean -o target/allure-report && allure open
// ==========================================================================
}
ALLURE REPORT SPECIFICATION & WIRE CAPTURE MATRIX:
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β ALLURE CONSTRUCT β SYNTAX / CODE SIGNATURE β TARGET SCOPE β PRIMARY OPERATIONAL PURPOSE β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β AllureRestAssured Filterβ .filter(new AllureRestAssuredβ Spec / Request β Captures HTTP request & resp β
β @Epic β @Epic("Platform Name") β Class Level β Top-level domain grouping β
β @Feature β @Feature("Service Name") β Class / Method β Mid-level functional grouping β
β @Story β @Story("User Scenario") β Method Level β Specific user workflow test β
β @Severity β @Severity(SeverityLevel.CRIT)β Method Level β Test priority / impact rating β
β @Step β @Step("Description: {param}")β Method Level β Granular sub-step in report β
β @Attachment β @Attachment(value="Log", ..) β Method Level β Attaches method return value β
β Allure.addAttachment() β Allure.addAttachment(n, type)β In-Method API β Programmatic stream attachmentβ
β @Description β @Description("Details...") β Method Level β Extended markdown test notes β
β @Issue / @TmsLink β @Issue("JIRA-1234") β Method Level β Direct link to bug / test caseβ
β @Owner β @Owner("SDET Lead") β Method Level β Test author attribution β
β environment.properties β target/allure-results/env.. β Results Folder β Populates Environment widget β
β CLI Serve β allure serve target/allure.. β Terminal / CI β Spawns live report web server β
β CLI Generate β allure generate --clean β Terminal / CI β Compiles standalone HTML site β
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββ€
β TOP 5 ALLURE REPORTING BEST PRACTICES: β
β 1. Attach AllureRestAssured globally: Automatically log all wire exchanges without manual code. β
β 2. Use AspectJ Weaver javaagent: Ensure @Step parameters and @Attachment annotations render properly. β
β 3. Group tests via @Epic, @Feature, @Story: Align automation reporting with Jira and Agile structures. β
β 4. Generate environment.properties in @BeforeSuite: Display OS, Java version, and target base URLs. β
β 5. Use 'allure serve' for local triage: Avoid browser CORS errors when inspecting local test results. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ