Minimal, dependency-free FreeMarker templates (request.ftl, response.ftl) for clean, consistent HTTP attachments in Allure Report.
Designed to blend seamlessly into the Allure UI, with structured blocks and safe HTML escaping.
- Zero external resources — no Bootstrap, jQuery, highlight.js, or CDNs.
- Clean, consistent cards (Request / Headers / Body / Cookies / Curl; Status code for Response).
- Safe rendering (
?html) to prevent layout breaks from raw payloads. - Unified spacing, rounded corners, and light/dark-friendly colors.
- Monospace font stack for code, configurable via CSS variables.
- Both templates share the same CSS variables, ensuring a consistent look and feel.
- Optional iframe autoresize (delete the
<script>block to disable it).
- Add dependency (required for the AllureRestAssured listener, not for the templates):
dependencies {
testImplementation("io.qameta.allure:allure-rest-assured:x.xx.x")
}- Copy the two
.ftlfiles intotplpackage in your project resources (the path must match exactly):
src/
test/
resources/
tpl/
request.ftl
response.ftl
- Create a listener class in your
helperspackage:
import io.qameta.allure.restassured.AllureRestAssured;
public class ApiAllureListener {
private ApiAllureListener(){}
private static final AllureRestAssured FILTER = new AllureRestAssured()
.setRequestTemplate("request.ftl")
.setResponseTemplate("response.ftl");
public static AllureRestAssured filter() {
return FILTER;
}
}- Add
filter()to@BeforeAll, for example:
public class TestBase {
@BeforeAll
static void setupApi() {
<your configs>
RestAssured.filters(ApiAllureListener.filter());
}
}