Grouping the tests in testng

We can group the tests using groups parameter. In below example, we have put test1 in 2 groups – sanity and smoke. We have also put the test2 in another group called as regression. Using suite XML file, we can execute the tests from specific group.
 
package org.softpost;

import org.testng.annotations.Test;

public class AppTest{
    @Test(groups = {"sanity","smoke"})
    public void test1(){
        System.out.println("Test1");
    }

    @Test(groups = {"regression"})
    public void test2(){
        System.out.println("Test2");
    }
}

Web development and Automation testing

solutions delivered!!