关于Selenium / Maven / TestNG for CI的http://qtp-help.blogspot.in/2013/09/webdriver-with-maven.html教程(将添加jenkins)。测试运行正常,同时仅使用TestNG构建,但在使用“maven测试”时会遇到错误。
接下来是测试:import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.FirefoxDriver;
import org.openqa.selenium.firefox.*;
import org.testng.annotations.Test;
public class GoogleTest {
private WebDriver driver;
@Test
public void verifySearch() {
driver = new FirefoxDriver();
driver.get("http://www.google.com/");
driver.quit();
}
}
继承人pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MavenWebDriverDemo</groupId>
<artifactId>MavenWebDriverDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.33.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.33.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
<scope>test</scope>
</dependency>
</dependencies>
在我尝试通过Maven Test执行pom之后,TestNG会执行所有传递,但继承控制台输出: http://pastebin.com/jPiep8cT
请帮忙!谢谢!