2.50/Automated Testing/login
import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; import com.thoughtworks.selenium.*; /** * Test login process */ public class Login { /** * Browser used to test the application */ private Selenium selenium; /** * Prepare the browser for the execution * @throws Exception */ @Before public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:8180/"); selenium.start(); selenium.windowMaximize(); } /** * Test login */ @Test public void testLogin() { // Perform login // open login page selenium.open("openbravo/security/Login_FS.html"); // enter the user name selenium.type("user", "Openbravo"); // enter the password selenium.type("password", "openbravo"); // click login button selenium.click("buttonOK"); // wait for the main page to load selenium.waitForPageToLoad("30000"); } /** * Close the browser * @throws java.lang.Exception */ @After public void tearDown() throws Exception { selenium.stop(); } }