2012-07-10 46 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