Reading about Allure is not enough. You need to set it up, break some tests, and see the report with your own eyes. These exercises build on the test suite you created in previous chapters. Complete them in order — each one adds a layer to your reporting setup.
Exercise 1: Basic Allure Setup
Add the allure-testng dependency and AspectJ weaver to your pom.xml
Create src/test/resources/allure.properties with the results directory
Install Allure CLI on your machine (brew install allure or scoop install allure)
Run mvn clean test and verify that target/allure-results/ contains JSON files
Run allure serve target/allure-results and verify the report opens in your browser
Exercise 2: Add Annotations to Existing Tests
Add @Epic("Banking Portal") and @Feature("User Authentication") to your LoginTests class
Add @Story, @Description, and @Severity to every test method in LoginTests
Add @Step annotations to every method in LoginPage
Run tests and check the Behaviors tab — verify the Epic > Feature > Story hierarchy
Click a test and verify that steps appear in the step trace
Exercise 3: Screenshot on Failure
Create the AllureScreenshotListener class from this chapter
Register it in your testng.xml
Intentionally break a test (change a locator or assertion to make it fail)
Run the tests and open the Allure report
Click the failed test — verify the screenshot, page URL, and page source are attached
Fix the broken test and run again to see the pass result
Exercise 4: Custom Attachments
Create the AllureUtils class with attachText(), attachJson(), and logStep() methods
In a fund transfer test, attach the transfer details as JSON after a successful transfer
In a search test, attach the search results count as text
View the attachments in the Allure report for those tests
Exercise 5: Categories and Environment
Create categories.json with at least 3 custom failure categories
Create environment.properties with browser, OS, and environment info
Copy both files to target/allure-results/ (or set up the Maven Resources plugin)
Run tests with at least one intentional failure and check the Categories tab
Check the Overview page — verify environment info appears
Exercise 6: Full Report Exploration
With at least 10 annotated tests (some passing, some failing), generate a full Allure report
Explore every tab: Overview, Suites, Behaviors, Graphs, Timeline, Categories, Packages
Find a failed test and trace the failure from the step trace to the screenshot to the error message
Take note of which sections would be useful for: a standup update, a developer debugging, a manager review
Try allure generate (not serve) — create a static report and open it separately
Do not skip the "intentionally break a test" exercises. The whole point of a reporting tool is to help when things go wrong. You need to see what a failed test looks like in Allure — the screenshot, the step that turned red, the error message. If you only see green, you have not really used Allure.
After completing these exercises, you will have a portfolio-ready project. A Selenium + TestNG + Allure framework with page objects, data-driven tests, screenshots on failure, and rich reports is exactly what interviewers look for. Push it to GitHub.
Key Point: Set up Allure, annotate your tests, break something on purpose, and explore every tab. That is how you learn reporting — not by reading, by doing.