Allure Features: Steps, Attachments and Labels

Allure becomes truly powerful when you enrich results with steps, attachments and labels that reflect how users and teams think about the system. Instead of a flat list of tests, you get structured narratives and groupings that guide debugging.

Using Steps, Attachments and Labels in Allure

Steps describe the actions within a test, attachments store extra context like screenshots or request/response bodies, and labels tag tests with metadata such as feature, story, severity or owner. Framework plugins usually expose decorators or helper functions to add this information.

# Example: pytest with Allure steps and attachments
import allure

@allure.feature("Checkout")
@allure.severity(allure.severity_level.CRITICAL)
def test_checkout_happy_path(api_client):
    with allure.step("Create test user"):
        user = api_client.create_user()

    with allure.step("Add item to cart"):
        api_client.add_to_cart(user, sku="SKU-123")

    with allure.step("Submit order"):
        response = api_client.checkout(user)
        allure.attach(str(response.json()), name="checkout_response", attachment_type=allure.attachment_type.JSON)

    assert response.status_code == 200
Note: Labels like @allure.feature and @allure.severity allow stakeholders to filter reports by business area or impact.
Tip: Use steps for meaningful actions, not every tiny API call, so reports stay readable and aligned with user journeys.
Warning: Overusing attachments (for example logging every response body) can bloat report size and slow down generation.

With thoughtful use of these features, a failing test in Allure reads like a short story that explains what happened, not just a stack trace.

Common Mistakes

Mistake 1 โ€” Using generic or misleading labels

This reduces value.

โŒ Wrong: Tagging everything with a single feature name or leaving severity as the default.

โœ… Correct: Choose labels that reflect real modules, journeys and risk levels.

Mistake 2 โ€” Attaching massive logs without limits

This hurts performance.

โŒ Wrong: Dumping entire logs or database snapshots into attachments.

โœ… Correct: Attach focused evidence (key responses, screenshots) that helps debug typical failures.

🧠 Test Yourself

How do steps and labels improve Allure reports?