Ignore:
Timestamp:
12/15/10 08:44:09 (13 years ago)
Author:
luiz-fernando
Message:

Ticket #1402 - Campos, mensagens e valores estao em properties

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/testlink/automation/src/test/java/br/gov/serpro/cte/common/BaseTestCase.java

    r3543 r3592  
    2424 */ 
    2525public class BaseTestCase extends SeleneseTestCase { 
     26        private Properties config; 
    2627        private Properties mensagens; 
    2728        private Properties campos; 
     
    3031        @Before 
    3132        public void setUp() throws Exception { 
     33                this.config = this.load("br/gov/serpro/cte/common/config.properties"); 
    3234                this.mensagens = this 
    3335                                .load("br/gov/serpro/cte/common/mensagens.properties"); 
    3436                this.campos = this.load("br/gov/serpro/cte/common/campos.properties"); 
    3537                this.valores = this.load("br/gov/serpro/cte/common/valores.properties"); 
    36                 String url = "https://cte.serpro.gov.br"; 
     38                String url = getConfig("url"); 
    3739                DAOSelenium conn = new DAOSelenium("localhost", 4444, "*firefox", url); 
    3840                selenium = conn.newConnection(); 
    3941        } 
    4042 
     43        public String getConfig(String key) { 
     44                return this.config.getProperty(key); 
     45        } 
     46 
    4147        public String getMensagem(String key) { 
    4248                return this.mensagens.getProperty(key); 
     
    4854 
    4955        public String getCampo(String key, Object... args) { 
    50                 return MessageFormat.format(getCampo("email.responder.todos"), args); 
     56                return MessageFormat.format(getCampo(key), args); 
    5157        } 
    5258 
     
    6773        public void login() { 
    6874                selenium.open("/login.php"); 
    69                 selenium.type("user", "luiz-fernando.estivalet"); 
    70                 selenium.type("passwd", "senha"); 
     75                selenium.type("user", getConfig("user")); 
     76                selenium.type("passwd", getConfig("passwd")); 
    7177                selenium.click("submitit"); 
    72                 selenium.waitForPageToLoad("30000"); 
     78                selenium.waitForPageToLoad(getConfig("waitPage")); 
    7379        } 
    7480 
     
    7884        public void logout() { 
    7985                selenium.click("logout_id"); 
    80                 selenium.waitForPageToLoad("30000"); 
     86                selenium.waitForPageToLoad(getConfig("waitPage")); 
    8187        } 
    8288 
     
    120126        public void waitForElement(String element, boolean click) throws Exception { 
    121127                for (int second = 0;; second++) { 
    122                         if (second >= 60) 
     128                        if (second >= Integer.parseInt(getConfig("timeout"))) 
    123129                                fail("timeout"); 
    124130                        try { 
     
    127133                        } catch (Exception e) { 
    128134                        } 
    129                         Thread.sleep(1000); 
     135                        Thread.sleep(100); 
    130136                } 
    131137                if (click) { 
     
    193199 
    194200        private Object createObject(Constructor<?> constructor, Object[] arguments) { 
    195  
    196                 System.out.println("Constructor: " + constructor.toString()); 
    197201                Object object = null; 
    198202 
    199203                try { 
    200204                        object = constructor.newInstance(arguments); 
    201                         System.out.println("Object: " + object.toString()); 
    202205                        return object; 
    203206                } catch (InstantiationException e) { 
Note: See TracChangeset for help on using the changeset viewer.