Behaviours Mapping in Allure Report

Profile picture for user arilio666

This article will show how we can do behavior-driven reporting, i.e., features and stories. In the case of the development-based approach, tests are classified by features and stories. 

Epic, Feature, and Stories annotations are used for this.

@Epic("Allure")
@Feature("Screen Support")
public class Play {
    @Test
    @Story("Pass Resolution Dynamically In Viewport")
    public void alluPlay() {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int width = (int) screenSize.getWidth();
        int height = (int) screenSize.getHeight();
        Playwright playwright = Playwright.create();
        Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setHeadless(false));
        // BrowserContext newContext = browser.newContext(
        // new
        // Browser.NewContextOptions().setRecordVideoDir(Paths.get("Videos/")).setRecordVideoSize(1280,
        // 720));
        BrowserContext newContext = browser.newContext(new Browser.NewContextOptions().setViewportSize(width, height));
        Page page = newContext.newPage();
        page.navigate("http://www.programsbuzz.com");
        Locator body = page.locator("body");
        String bodyText = body.textContent();
        Assert.assertFalse(bodyText.contains("Spam Message"), "Spam Text Not Found!!");
        }}
        
  • Here we can use the Epic and Feature annotations over the class, and then we passed in the story details over the test level.
  • Here we can see how they look visually in the report.
  • They come under the Epic information we provide with proper sub-divisions.