December 13, 2010

Sample script using JUnit

Here is the sample script which will open a page...

This script was written using JUnit...


import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestCase;
import com.thoughtworks.selenium.Selenium;

public class Google1 extends SeleneseTestCase{

private Selenium selenium;
private SeleniumServer seleniumServer;

@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*iehta", "http://");
seleniumServer = new SeleniumServer();
seleniumServer.start();
selenium.start();
}



@Test
public void testText1() throws Exception {
selenium.open("http://www.yahoo.com");
selenium.windowMaximize();
}
@After
public void tearDown() throws Exception {
selenium.stop();
seleniumServer.stop();
}
}

No comments:

Post a Comment