2012-07-10 32 views
0

我正在写经硒网络驱动器的测试,这里是我的代码:Maven的故障保护,插件没有看到我的测试(seleniumHQ)

的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> 

但问题依然存在。

回答

1

maven-failsafe-plugin的目标被命名为集成测试代替测试。此外,如果您将命名约定更改为maven-failsafe-plugin的约定,则不需要包含等文件的任何配置。只需使用默认值。 此外,我假定你已经开始通过运行集成测试:

mvn verify 
+0

我尝试了默认配置,它工作正常,但是当我试图用另外一个继承人的代码: \t \t \t \t \t 集成测试 \t \t \t \t \t \t \t 测试 \t \t \t \t \t \t <结构> \t \t \t \t \t \t \t \t \t \t \t \t \t **/* IT.java \t \t \t \t \t \t \t \t \t \t – 2012-07-10 13:02:44

+0

我试图来测试它与MVN验证和MVN集成测试和遇到错误:[错误]无法在插件org.apache.maven.plugins中找到目标'测试':maven-failsafe-plugin:2.11在可用目标中验证,帮助,集成测试 - > [Help 1] – 2012-07-10 13:05:21

+1

正如我在回答你需要改变配置 test into integration-test khmarbaise 2012-07-10 13:15:08