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

Add annotation to define "test group" and its dependencies #2787

Open
1 of 7 tasks
vlsi opened this issue Jul 28, 2022 · 0 comments
Open
1 of 7 tasks

Add annotation to define "test group" and its dependencies #2787

vlsi opened this issue Jul 28, 2022 · 0 comments

Comments

@vlsi
Copy link
Contributor

vlsi commented Jul 28, 2022

TestNG Version

7.6.1

Expected behavior

It would be nice if there was a way to declare "group" and its dependencies.

For instance, something like

interface TestGroups {
    @TestGroup
    String FIRST = "FIRST";

    @TestGroup(dependsOnGroups = {FIRST})
    String SECOND = "SECOND";
}

class TestA: TestGroups {
    @Test(groups = [FIRST])
    fun `first group`() {
        println("A: first")
    }

    @Test(groups = [SECOND])
    fun `second group`() {
        println("A: second")
    }
}
...
  • dependencies between groups would be better described in test group declaration themselves rather than in @BeforeGroups / @AfterGroups.
  • the example above uses "implement TestGroup interface" approach so TestNG could scan and infer groups
  • It might be useful to have something like @ImportGroups(TestGroups.class) annotation so users don't have to implement the interface and they would still be able to launch individual test from the IDE (TestNG would infer the needed group definitions)

Actual behavior

See #2786

Is the issue reproducible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans
@vlsi vlsi changed the title Add annotation to define "group" Add annotation to define "test group" and its dependencies Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant