allure-framework / allure-java

Allure integrations for Java test frameworks
Apache License 2.0
357 stars 226 forks source link

Before Suite and AfterSuite steps not appearing in allure report after version 2.21 #1045

Open AhmdZanoon opened 11 months ago

AhmdZanoon commented 11 months ago

Describe the Bug

after suite method not shown in allure report since version 2.22 for example below code

Steps to Reproduce

package allure;

import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.Test;

import io.qameta.allure.Attachment; import io.qameta.allure.Step;

public class TestClass {

   @BeforeSuite
public void beforeSuite() {
    stepHasNestedSteps();
}

@BeforeMethod
public void beforeMethod() {
    stepHasNestedSteps();
}

@Step("step has nested steps")
public void stepHasNestedSteps() {
    callAttachment();
    callAttachment2();
}

@Attachment("attachment - nested ")
public void callAttachment() {
    System.out.println("attachment");
}

@Step("another nested step")
public void callAttachment2() {
    callAttachment();
}

@Test(description="description")
public void test() {
stepHasNestedSteps();

}

@AfterMethod(description ="after test")
public void after(){
    stepHasNestedSteps();
}

@AfterSuite(description ="after Suit")
public void afterSuit() {
    stepHasNestedSteps();
}

}

Expected Behaviour

before suit and after suit to appear in report

Screenshots or Additional Context

No response

What Language are you using?

Java

What Framework/Allure Integration you are using?

allure-testng

What version of Allure Integration you are using?

2.25.0

What version of Allure Report you are using?

2.25.0

Code of Conduct

AlexChernookov commented 11 months ago

@zanoon2020 I encounter a similar problem with the @Step annotation. In case of using following code:

@Step("my step")
public void doSomething(){}

the record "my step" is not appearing in Allure report

but when I make

Allure.step("dummy step", ()->doSomething())

this record is appearing in Allure report as "dummy step" I was debugging AllureLifecycle and when I'm using @Step looks like method startStep is never called. But it works fine for static method step

In my case it's happed for testng 7.5 allure 2.23.0

AhmdZanoon commented 11 months ago

Thanks @AlexChernookov , actually my issue not with @ step, any idea how to do the same with @beforeSuit