Allure Reports

Setup With TestNG

Allure writes JSON result files during the run, and the Allure command line turns them into an interactive site with steps, attachments, categories, trends and history. Product companies and CI pipelines often prefer it.

<dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-testng</artifactId>
    <version>2.29.0</version>
    <scope>test</scope>
</dependency>

<!-- surefire needs the AspectJ agent so @Step methods are recorded -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.5.1</version>
    <configuration>
        <argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.9.22/aspectjweaver-1.9.22.jar"</argLine>
    </configuration>
</plugin>

Steps and Descriptions

public class LoginPage extends BasePage {
    @Step("Log in as {user}")
    public HomePage loginAs(String user, String pwd) { ... }
}

public class CheckoutTest extends BaseTest {
    @Test
    @Epic("Checkout")
    @Feature("Coupons")
    @Severity(SeverityLevel.CRITICAL)
    @Description("SAVE10 gives 10% off on the cart total")
    public void applyCoupon() { ... }
}

Example

Generate and open the report:

mvn clean test
allure serve target/allure-results

Example output

Generating report to temp directory...
Report successfully generated to C:\Users\asha\AppData\Local\Temp\allure-report
Starting web server...
Server started at <http://192.168.1.5:52411/>. Press <Ctrl+C> to exit

Extent vs Allure

Extent Reports 5Allure
Outputone HTML fileresults folder + generated site
Stepsmanual test.info(...) calls@Step annotations, automatic
History / trendsnoyes (keep the history folder between runs)
CI integrationarchive the HTML fileJenkins and GitHub Actions plugins
Cucumber supportyes (adapter)yes (allure-cucumber7-jvm)