Challenge - 5 Problems
Allure Reporting Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Allure Step Annotation Output
What will be the output in the Allure report when the following Java method annotated with @Step is executed during a Selenium test?
Selenium Java
import io.qameta.allure.Step; public class LoginTest { @Step("Enter username {username}") public void enterUsername(String username) { System.out.println("Typing username: " + username); } public void testLogin() { enterUsername("user123"); } }
Attempts:
2 left
💡 Hint
The @Step annotation supports parameter placeholders in curly braces that get replaced with actual values.
✗ Incorrect
The @Step annotation in Allure allows you to define a step name with placeholders like {username}. When the method runs, Allure replaces {username} with the actual argument value, so the report shows 'Enter username user123'. The console output is separate and also printed.
❓ assertion
intermediate2:00remaining
Allure Attachment Assertion
Which assertion correctly verifies that an image attachment was added to the Allure report in a Selenium Java test?
Selenium Java
import io.qameta.allure.Allure; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class ScreenshotTest { @Test public void testScreenshotAttachment() { byte[] image = new byte[]{1, 2, 3}; Allure.addAttachment("Screenshot", "image/png", new java.io.ByteArrayInputStream(image), ".png"); // Which assertion below confirms the attachment was added? } }
Attempts:
2 left
💡 Hint
Allure attachments are stored in report files, not accessible via direct assertions in code.
✗ Incorrect
Allure attachments are added to the report files during test execution. There is no API to assert attachment presence programmatically inside the test. Verification is done by viewing the generated Allure report after the test run.
🔧 Debug
advanced2:00remaining
Allure Report Missing Steps Debugging
A Selenium Java test uses @Step annotations, but the Allure report shows no steps recorded. What is the most likely cause?
Attempts:
2 left
💡 Hint
Allure needs a listener or plugin to capture test execution events and generate results.
✗ Incorrect
If the Allure report shows no steps, it usually means the Allure lifecycle listener is not active or the test runner is not configured to produce the results folder. Without this, @Step annotations have no effect in the report.
❓ framework
advanced2:00remaining
Integrating Allure with Selenium and TestNG
Which code snippet correctly integrates Allure reporting with Selenium tests using TestNG?
Selenium Java
import io.qameta.allure.Step; import org.testng.annotations.Test; public class SearchTest { @Step("Open Google homepage") public void openHomePage() { // Selenium code to open page } @Test public void testSearch() { openHomePage(); // Additional test steps } }
Attempts:
2 left
💡 Hint
TestNG requires listeners to integrate with Allure reporting.
✗ Incorrect
To integrate Allure with TestNG, you must add the AllureTestNg listener via @Listeners annotation or in testng.xml. This enables Allure to capture test events and generate reports.
🧠 Conceptual
expert2:00remaining
Best Practice for Attaching Screenshots in Allure Reports
In a Selenium Java test, what is the best practice to attach a screenshot to the Allure report only when a test fails?
Attempts:
2 left
💡 Hint
Test frameworks provide hooks to run code after each test with access to test status.
✗ Incorrect
The best practice is to use a test framework hook like TestNG's @AfterMethod to check if the test failed, then capture and attach the screenshot. This avoids unnecessary attachments and keeps reports clean.