Below is the script which is using multiple @Test TestNG Annotations..
import static org.testng.Assert.assertEquals;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
import org.testng.annotations.*;
public class Second {
public static Selenium selenium;
@Test
public static void sample_1() throws InterruptedException {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.google.co.in");
selenium.start();
selenium.open("http://www.google.co.in");
System.out.println(a);
selenium.type("id=lst-ib", "Testing");
selenium.click("name=btnG");
Thread.sleep(1000);
}
@Test
public static void sample_2() throws InterruptedException {
assertEquals(selenium.getTitle(), "Testing - Google Search");
Thread.sleep(1000);
selenium.click("css=em");
Thread.sleep(1000);
assertEquals(selenium.getTitle(), "Software testing - Wikipedia, the free encyclopedia");
Thread.sleep(3000);
selenium.click("css=#ca-talk>span>a");
}
}
import static org.testng.Assert.assertEquals;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
import org.testng.annotations.*;
public class Second {
public static Selenium selenium;
@Test
public static void sample_1() throws InterruptedException {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.google.co.in");
selenium.start();
selenium.open("http://www.google.co.in");
System.out.println(a);
selenium.type("id=lst-ib", "Testing");
selenium.click("name=btnG");
Thread.sleep(1000);
}
@Test
public static void sample_2() throws InterruptedException {
assertEquals(selenium.getTitle(), "Testing - Google Search");
Thread.sleep(1000);
selenium.click("css=em");
Thread.sleep(1000);
assertEquals(selenium.getTitle(), "Software testing - Wikipedia, the free encyclopedia");
Thread.sleep(3000);
selenium.click("css=#ca-talk>span>a");
}
}
No comments:
Post a Comment