package seleniumTestNG;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
public class TestNG_I_TestNG_Group_Test {
WebDriver driver;
@Test(groups={"smoke"})
public void google() throws Exception {
Thread.sleep(5000);
driver.get("http://www.fb.com");
System.out.println("FB is Smoke");
}
@Test(groups={"sanity"})
public void gmail() throws InterruptedException {
Thread.sleep(5000);
driver.get("http://www.gmail.com");
System.out.println("Gmail is Sanity");
}
@Test(groups={"Retesting"})
public void fb() {
driver.get("http://www.twitter.com");
System.out.println("Twitter is Retesting");
}
@Test(groups={"Regression"})
public void twitter() {
driver.get("http://www.quora.com");
System.out.println("Quora is Regression");
}
@Test(groups={"sanity"})
public void googleLangs() {
driver.get("https://www.google.co.in/imghp");
System.out.println("Sanity");
}
@BeforeTest(groups={"sanity"})
public void beforeTest() {
driver=new FirefoxDriver();
driver.manage().window().maximize();
/*System.setProperty("webdriver.chrome.driver","E:\\lib\\ChromeDriver.exe");
driver = new ChromeDriver();*/
}
}
//=================================================================//
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<groups>
<run>
<include name="sanity" />
<exclude name="smoke"/>
<exclude name="Regression"/>
</run>
</groups>
<classes>
<class name="seleniumTestNG.TestNG_I_TestNG_Group_Test"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->