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 test that belong to a group

Perform the following steps to create a test that belongs to a group:

  1. Open Eclipse and create a Java project with the structure shown in the following screenshot. Please make sure that the TestNG library is added to the build path of the project as mentioned in Chapter 1, Getting Started.
    Time for action – creating test that belong to a group
  2. Create a new class with the name TestGroup under the test.groups package and replace the following code in it:
    package test.groups; import org.testng.annotations.Test; public class TestGroup { @Test(groups={"test-group"}) public void testMethodOne(){ System.out.println("Test method one belonging to group."); } ...

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