O'Reilly logo

TestNg Beginner's Guide by Varun Menon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating a test having multiple groups

Perform the following steps to create a test having multiple groups:

  1. Open Eclipse and create a new Java class file with the name MultiGroup under the test.groups package in the previously created project.
  2. Replace the existing code with the following code and save the file:
    package test.groups; import org.testng.annotations.Test; public class MultiGroup { @Test(groups={"group-one"}) public void testMethodOne(){ System.out.println("Test method one belonging to group."); } @Test(groups={"group-one","group-two"}) public void testMethodTwo(){ System.out.println("Test method two belonging to both group."); } @Test(groups={"group-two"}) public void testMethodThree(){ System.out.println("Test method ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required