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 – assigning a default group to a set of tests

Perform the following steps to assign a default group to a set of tests:

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

    The preceding class contains three methods that print a message ...

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