View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

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();
 	}
 }

Retrieved from "http://wiki.openbravo.com/wiki/2.50/Automated_Testing/login"

This page has been accessed 4,102 times. This page was last modified on 19 August 2011, at 21:42. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.