= 5 Minutos com Maven, TestNG e Selenium = [[PageOutline(1-3, Conteúdo)]] 1. Criar um novo projeto Maven no Eclipse: [[Image(maven1.png,450px)]] [[Image(maven2.png,450px)]] [[Image(maven3.png,450px)]] 2. Editar pom.xml para adicionar as dependencias do projeto logo abaixo da tag do projeto {{{ org.testng testng 5.14.1 test org.seleniumhq.selenium selenium 2.0b1 }}} Automaticamente o maven baixará todos as dependências e colocará no path do projeto. 3. Criar uma classe para testar a configuração: {{{ import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class FirefoxDriverExample { @Test public void testIt() { // Create a new instance of the firefox driver WebDriver driver = new FirefoxDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); driver.close(); } } }}} 4. Rodar o teste usando o TestNG. Basta clicar com o botão direito sobre a classe FirefoxDriverExample, selecionando Run As->TestNG Test [[Image(maven4.png,450px)]] O resultado da execução pode ser visto abaixo: [[Image(maven5.png,450px)]] ---- ''Última atualização: 17-Fev-2011''