Answer
Allure Report vs ExtentReports
Both generate HTML test reports, but they differ in philosophy, setup, and features.
Allure Report Setup (Maven)
XML
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.25.0</version>
</dependency>
testng.xml listener:
XML
<listeners>
<listener class-name="io.qameta.allure.testng.AllureTestNg"/>
</listeners>
No manual listener code needed — Allure hooks into TestNG automatically.
Allure Annotations
Java
import io.qameta.allure.*;
@Epic("User Management")
@Feature("Login")
public class LoginTest extends BaseTest {
@Test
@Story("Valid user can login")
@Severity(SeverityLevel.CRITICAL)
@Description("Verify that a valid user is redirected to dashboard after login")
@Link(name = "JIRA", url = "https://jira.company.com/browse/QA-123")
public void validLoginTest() {
Allure.step("Navigate to login page", () -> {
driver.get("https://automateqa.online/login");
});
Allure.step("Enter credentials", () -> {
driver.findElement(By.id("username")).sendKeys("admin");
driver.findElement(By.id("password")).sendKeys("secret");
});
Allure.step("Click login button", () -> {
driver.findElement(By.id("loginBtn")).click();
});
Assert.assertTrue(driver.getTitle().contains("Dashboard"));
}
}
Attach Screenshot to Allure
Java
@Attachment(value = "Screenshot", type = "image/png")
public byte[] takeScreenshot() {
return ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
}
// Call on failure in listener
@Override
public void onTestFailure(ITestResult result) {
takeScreenshot();
}
Generate Report
Bash
mvn test
allure serve target/allure-results # opens browser with interactive report
# OR
allure generate target/allure-results -o allure-report --clean
Allure vs ExtentReports Comparison
| Feature | Allure | ExtentReports |
|---|---|---|
| Setup effort | Low (auto listener) | Medium (manual listener code) |
| Report quality | Very modern, interactive | Professional, chart-based |
| CI/CD integration | Native (Jenkins plugin) | Manual configuration |
| Step-level detail | Yes (@Step, Allure.step()) | Manual logs only |
| Severity / epics | @Severity, @Epic, @Feature | No built-in |
| History & trends | Yes (needs history folder) | No |
| Languages | Multi-language | Java primarily |
| File size | Small (JSON + server) | Large (self-contained HTML) |
Allure Jenkins Integration
GROOVY
// Jenkinsfile
post {
always {
allure([results: [[path: 'target/allure-results']]])
}
}
When to choose:
- ✓Allure → modern projects, CI/CD first, need epic/story/severity hierarchy
- ✓ExtentReports → quick setup, standalone HTML, team prefers embedded screenshots
