Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: Java  |  size: 1.23 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.*;
  2.  
  3. import junit.framework.TestCase;
  4.  
  5. import com.thoughtworks.selenium.DefaultSelenium;
  6. import com.thoughtworks.selenium.Selenium;
  7. import com.thoughtworks.selenium.SeleniumException;
  8.  
  9. public class mainTest extends TestCase {
  10.         public Authorize authorize;
  11.         private static final String PATH_CONFIG=".\\src\\script\\";
  12.         private Properties properties;
  13.         private Selenium selenium;
  14.         public Selenium getSelenium(){
  15.                
  16.                 return this.selenium;
  17.         }
  18.         public void setUp() {
  19.                
  20.                 properties = new Properties();
  21.                 File configfile = new File(PATH_CONFIG,"script.properties");
  22.                 try {
  23.                         properties.load(new FileInputStream(configfile));
  24.                 }
  25.                 catch (Exception e) {
  26.                         System.out.println("ERROR!!!");
  27.                 }
  28.                
  29.                 selenium = new DefaultSelenium(
  30.                                           properties.getProperty("host"),
  31.                                                                                   Integer.valueOf(properties.getProperty("port")),
  32.                                                                   properties.getProperty("browser"),
  33.                                                                   properties.getProperty("domain"));
  34.                 selenium.start();
  35.         }
  36.        
  37.  
  38.         public void test_CheckMainPage() throws Exception {    
  39.                 selenium.open(properties.getProperty("domain"));
  40.                 try{
  41.                         selenium.waitForPageToLoad("10000");
  42.                 }
  43.                 catch (SeleniumException e)
  44.                 {
  45.                         Thread.sleep(6000);
  46.                        
  47.                 }
  48.                 ...
  49. }