Careeroza
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-resultsExample 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 5 | Allure | |
|---|---|---|
| Output | one HTML file | results folder + generated site |
| Steps | manual test.info(...) calls | @Step annotations, automatic |
| History / trends | no | yes (keep the history folder between runs) |
| CI integration | archive the HTML file | Jenkins and GitHub Actions plugins |
| Cucumber support | yes (adapter) | yes (allure-cucumber7-jvm) |