Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悶: Before Suite and AfterSuite steps not appearing in allure report anymore after version 2.21 #953

Open
1 task done
zanoon2020 opened this issue Aug 29, 2023 · 5 comments
Assignees
Labels
theme:testng TestNG related issue type:bug Something isn't working

Comments

@zanoon2020
Copy link

zanoon2020 commented Aug 29, 2023

What happened?

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

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();
	}
	

}

latest version
image

version 2.21
image

What Allure Integration are you using?

allure-testng

What version of Allure Integration you are using?

2.24.0

What version of Allure Report you are using?

2.24.0

Code of Conduct

  • I agree to follow this project's Code of Conduct
@zanoon2020 zanoon2020 added triage type:bug Something isn't working labels Aug 29, 2023
@zanoon2020 zanoon2020 changed the title 馃悶: AfterSuite step not appearing in allure report since version 2.22.0 馃悶: Before Suite and AfterSuite steps not appearing in allure report since version 2.22.0 Aug 29, 2023
@zanoon2020 zanoon2020 changed the title 馃悶: Before Suite and AfterSuite steps not appearing in allure report since version 2.22.0 馃悶: Before Suite and AfterSuite steps not appearing in allure report anymore after version 2.21 Aug 29, 2023
@dr29bart
Copy link
Contributor

dr29bart commented Aug 30, 2023

To workaround a bug you can downgrade this dep:

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-generator</artifactId>
            <version>2.21.0</version>
        </dependency>

It also makes sense to move this issue to the main project

@zanoon2020
Copy link
Author

To workaround a bug you can downgrade this dep:

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-generator</artifactId>
            <version>2.21.0</version>
        </dependency>

It also makes sense to move this issue to the main project
@dr29bart you mean report it again , or you already did it

@baev
Copy link
Member

baev commented Oct 5, 2023

Due to performance issues, we dropped support for recursive containers in Allure Report (it was never supported in Allure TestOps).

We must use separate containers for each test fixture to fix the issue.

@baev baev self-assigned this Oct 5, 2023
@zanoon2020
Copy link
Author

zanoon2020 commented Dec 5, 2023

dear @baev any update on this one , or any missing data from my side , i'm still using version 2.21 as a workaround and i'm not able to generate single file because of this , your support is highly appreciated

@dr29bart
Copy link
Contributor

dr29bart commented Apr 2, 2024

Here is a workaround: by using custom listener create links between suite and test classes:

|_suite
|__textContext
|____TestClass
|_______testMethod
import io.qameta.allure.Allure;
import java.util.Objects;
import org.testng.ITestListener;
import org.testng.ITestResult;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

@Listeners(SampleTest.AllureTestNGListener.class)
public class SampleTest {

    @AfterSuite
    public void after() {
        Allure.step("after step");
    }

    @Test
    public void test() {
        Allure.step("test step");
    }

    public static class AllureTestNGListener implements ITestListener {
        @Override
        public void onTestStart(final ITestResult testResult) {
            Allure.getLifecycle().getCurrentTestCase()
                .ifPresent(testId -> {
                    var suite = testResult.getTestContext().getSuite();
                    var suiteId = Objects.toString(suite.getAttribute("ALLURE_UUID"));
                    Allure.getLifecycle().updateTestContainer(suiteId, container -> container.getChildren().add(testId));
                });
        }
    }
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:testng TestNG related issue type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants