
Untitled
By: a guest on
Aug 6th, 2012 | syntax:
None | size: 1.55 KB | hits: 19 | expires: Never
public class junitTestCaseName extends TestCase {
private Properties properties;
private Selenium selenium;
public void setUp() {
properties = new Properties();
try {
properties.load(
getClass().
getClassLoader().
getResourceAsStream("my.properties"));
} catch (IOException e) {
throw new RuntimeException(e);
}
selenium = new DefaultSelenium(
properties.getProperty("host"),
Integer.valueOf(properties.getProperty("port")),
properties.getProperty("browser"),
properties.getProperty("site"));
selenium.start();
}
public void testValidRegisration() {
selenium.open(properties.getProperty("accountPage"));
selenium.type("edit-name", properties.getProperty("user"));
selenium.type("edit-pass", properties.getProperty("password"));
selenium.click("//input[@id='edit-submit' and @name='op' and @value='Log in']");
selenium.waitForPageToLoad(“30000”));
assertEquals(true, selenium.isTextPresent("Hello, User."));
selenium.click("link=Log out " + properties.getProperty("userName"));
selenium.waitForPageToLoad(“30000”));
}
public void tearDown() {
selenium.stop();
}
}