我正在通过selenium web driver编写测试,这是我的代码:
的pom.xml
<project>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.24.1</version>
</dependency>
</dependencies>
<build>
<finalName>SeleniumebDriverProject</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.11</version>
<configuration>
<!-- Skip the normal tests, we'll run them in the integration-test phase-->
<skip>false</skip>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我的测试类名为GoogleTest.java。 阅读此帖后:failsafe plugin won't run on one project but will run on another -- why?
我改变了班级的名字,所以它是:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.11</version>
<configuration>
<!-- Skip the normal tests, we'll run them in the integration-test phase-->
<skip>false</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
<executions>
</plugin>
但问题仍然存在。
答案 0 :(得分:1)
maven-failsafe-plugin的目标是 integration-test ,而不是 test 。此外,如果您将命名约定更改为maven-failsafe-plugin的约定,则不需要任何包含等文件的配置。只需使用默认值。 此外,我假设您已经开始通过以下方式运行集成测试:
mvn verify