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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@AfterGroups is executed for each "finished" group when it has multiple groups defined #2754

Closed
2 of 7 tasks
velma opened this issue Apr 25, 2022 · 0 comments · Fixed by #2753
Closed
2 of 7 tasks
Milestone

Comments

@velma
Copy link
Contributor

velma commented Apr 25, 2022

TestNG Version

7.5

Expected behavior

a configuration method annotated with AfterGroups should be invoked once only after all tests with groups defined in configuration method are invoked

Actual behavior

when @AfterGroups annotated method has multiple groups then it will be invoked after the last method of each of this group

Is the issue reproducible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

public class ATest {

    @AfterGroups(groups = {"group-1", "group-2", "not-defined"})
    public void afterGroup() {
        System.out.println("after-group");
    }

    @Test(groups = "group-1")
    public void test1() {
        System.out.println("test-1");
    }

    @Test(groups = "group-2")
    public void test2() {
        System.out.println("test-2");
    }
}

Output

test-1
after-group
test-2
after-group

Contribution guidelines

Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants