Changes between Initial Version and Version 1 of ExpressoTestCenter/auto/tutorial


Ignore:
Timestamp:
02/16/11 15:31:27 (13 years ago)
Author:
luiz-fernando
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExpressoTestCenter/auto/tutorial

    v1 v1  
     1= 10 Minutos com Maven, TestNG e Selenium = 
     2 
     3  1. Criar um novo projeto Maven no Eclipse: 
     4 
     5maven1.png 
     6 
     7maven2.png 
     8 
     9maven3.png 
     10 
     11  2. Editar pom.xml para adicionar as dependencias do projeto logo abaixo da tag <name> do projeto 
     12 
     13{{{ 
     14        <dependencies> 
     15                <dependency> 
     16                  <groupId>org.testng</groupId> 
     17                  <artifactId>testng</artifactId> 
     18                  <version>5.14.1</version> 
     19                  <scope>test</scope> 
     20                </dependency> 
     21                        <dependency> 
     22                        <groupId>org.seleniumhq.selenium</groupId> 
     23                        <artifactId>selenium</artifactId> 
     24                        <version>2.0b1</version> 
     25                </dependency> 
     26        </dependencies> 
     27}}} 
     28 
     29Automaticamente o maven baixará todos as dependências e colocará no path do projeto. 
     30 
     31  3. Criar uma classe para testar a configuração: 
     32 
     33{{{ 
     34import org.openqa.selenium.By; 
     35import org.openqa.selenium.WebDriver; 
     36import org.openqa.selenium.WebElement; 
     37import org.openqa.selenium.firefox.FirefoxDriver; 
     38import org.testng.annotations.Test; 
     39 
     40 
     41public class FirefoxDriverExample { 
     42            
     43        @Test 
     44        public void testIt() { 
     45                // Create a new instance of the firefox driver 
     46                WebDriver driver = new FirefoxDriver(); 
     47 
     48                // And now use this to visit Google 
     49                driver.get("http://www.google.com"); 
     50 
     51                // Find the text input element by its name 
     52                WebElement element = driver.findElement(By.name("q")); 
     53 
     54                // Enter something to search for 
     55                element.sendKeys("Cheese!"); 
     56 
     57                // Now submit the form. WebDriver will find the form for us from the element 
     58                element.submit(); 
     59 
     60                // Check the title of the page 
     61                System.out.println("Page title is: " + driver.getTitle()); 
     62                 
     63                driver.close(); 
     64            } 
     65 
     66} 
     67}}} 
     68 
     694. Rodar o teste usando o TestNG.