Search code examples
junitselenium-webdriverwebdrivertestng

What do groups do in TestNG?


I am trying to know the how the group parameter in @Test work.

Why do we use groups, and what is the difference between @Test(groups = { "fast" }) and @Test(groups = { "slow" }) in both Junit and TestNG ?


Solution

  • Groups allow you to run certain tests (so I can, say, only run the tests in group X).

    The groups "fast" and "slow" have no special meaning in JUnit or TestNG. I would imagine whoever designed the framework you are using split your tests based on how long they take to run.

    Also, I'm betting your project is using TestNG. Only TestNG has support for groups in the annotation, and you would run into some really weird code/output if you mixed them.