Sunday, March 19, 2017

TestNG Driver Initialization using @BeforeTest annotations



TestNG Driver Initialization 



public class homepage {
public String url ="http://www.google.co.in";
public WebDriver driver;

/* Here this code will launch chrome browser*/

@BeforeTest
public void Setup() throws InterruptedException
{
System.setProperty("webdriver.chrome.driver","E:\\SeleniumTesting\\chromedriver.exe");
driver = new ChromeDriver();
driver.get(url);
Thread.sleep(6000);
}

/* Here you can start writing test scripts*/
@Test(priority=0)
public void bannerImageDisplay() 
{
}
@Test(priority=1)
public void bannerImageDisplay1() 
{
}
@Test(priority=2)
public void bannerImageDisplay2() 
{
}
}

No comments:

Post a Comment