Notes
Who reads it
Think about who reads the report. A developer needs the failing step, the request and response, a screenshot and logs. A tester needs to know which rule and which data, and whether the test is flaky. A manager wants totals, the trend over time and what blocks a release. Plain console output serves none of them well, and it disappears with the CI machine.
- developer: which step failed, the request, the response, the screenshot, the logs
- tester: which rule, which data, is it flaky?
- manager: how many pass, trend over time, what is blocked
- console output alone serves nobody well
How Allure works
Allure works in two stages. First, tests run with an Allure adapter for their framework: pytest, JUnit five, TestNG, Cucumber or Playwright. The adapter writes raw result files, one JSON file per test plus attachments, into an allure results folder. Second, the Allure command line turns that folder into a static HTML report. Because results are just files, CI can merge results from many shards into one report.
1 run tests with an Allure
adapter (pytest, JUnit 5,
TestNG, Cucumber, Playwright)
→ allure-results/*.json
2 allure generate
allure-results -o allure-report
→ static HTML site
npx allure generate ... (CLI
needs Java) Steps and labels
In the test, labels group results: feature coupons, story save ten, severity critical. Steps describe what happens, in business words: add four notebooks, apply save ten, check the total. Attachments add evidence; here the coupon response body is attached as JSON. Steps and attachments are what turn a stack trace into a story a developer can follow.
@allure.feature("Coupons")
@allure.story("SAVE10")
@allure.severity(CRITICAL)
def test_save10_at_50(alice):
with allure.step("Add 4 notebooks"):
alice.post("/api/cart/items",..)
with allure.step("Apply SAVE10"):
r = alice.post(".../coupon", ..)
allure.attach(r.text, "coupon
response", JSON)
with allure.step("Check total")... A real report
We ran this test with ShopRung's coupon boundary bug on and generated the report. Under behaviors, coupons, save ten, the test is failed and marked critical. The first two steps passed, the third failed with assert four hundred equals two hundred, and the attached coupon response holds the shop's reason. Anyone can see where it broke and why, without running anything.
Behaviors › Coupons › SAVE10
test_save10_at_50 FAILED
severity: critical
✔ Add 4 notebooks ($50.00)
✔ Apply SAVE10
📎 coupon response (JSON)
✘ Check the total is $49.99
AssertionError: assert 400 == 200 In Java
In Java, add the Allure JUnit five adapter. Annotations give the same labels: feature, story, severity. Allure dot step wraps a lambda as a named step, and add attachment adds a body, a log or a screenshot. Many teams also use the step annotation on page object methods, which needs AspectJ configured in Surefire, so every user action appears as a step automatically. Cucumber scenarios become steps without extra code.
// io.qameta.allure:allure-junit5
@Feature("Coupons") @Story("SAVE10")
@Severity(SeverityLevel.CRITICAL)
@Test void save10At50() {
Allure.step("Add 4 notebooks",
() -> cart.add(NOTEBOOK, 4));
var r = Allure.step("Apply SAVE10",
() -> cart.coupon("save10"));
Allure.addAttachment("response",
"application/json", r.body());
} Logging
Logs complement reports. Use levels: debug for detail, info for actions, warn and error for problems. Log actions and the ids of data you create, like order ten forty two created, so a failure can be traced. Send a request id header with API calls and log it, so the developer can find the same request in the server's logs. Never log passwords, tokens or card numbers; mask them. And attach each test's own log to its report entry on failure.
- levels: DEBUG detail, INFO actions, WARN, ERROR
- log actions and data ids: "order 1042 created"
- send and log a request id (X-Request-Id) to find the server side in its logs
- never log passwords, tokens, card numbers: mask them
- per test, attached on failure
Trends and categories
Reports become more useful over time. Allure keeps a history folder; copy it between CI runs and the report shows trend graphs and marks tests that both pass and fail as flaky. Categories sort failures by error message rules into product defects, test defects or environment problems. Publish the report as a CI artifact or a web page per branch, so the link can go straight into a bug ticket.
- keep the history folder between CI runs → trend graphs, retries, "flaky" mark
- categories: product defect vs test defect vs environment, by error message rules
- publish: CI artifact, a web page per branch, or a hosted report service
Common mistakes
Mistakes. Reports that vanish with the CI job. Steps named step one or click, which say nothing. Screenshots and videos for every passing test, making reports huge. Secrets in logs or attachments, which then get shared widely. Huge logs with no levels. And bug tickets with no link to the report, so everyone reruns the test anyway.
- reports nobody can open after the CI job ends
- steps named "step 1", "click"
- screenshots for passing tests (huge reports)
- secrets in logs or attachments
- giant logs with no levels
- no link from bug to report
Say it like this
In the interview: I use Allure through the framework's adapter, with features, stories and severity, steps named in business terms, and attachments on failure: the request and response, a screenshot, and the test's own log with request ids, secrets masked. CI publishes the report for every run with history, so trends and flaky tests are visible, and bug tickets link straight to the failing entry.
- "Allure from the test adapter: features, stories, severity, business-named steps, and attachments on failure: request and response, screenshot, per-test log with request ids, secrets masked.
- CI publishes it per run with history, so trends and flaky
- tests are visible."