2012-07-24 88 views
0

我有這個maven配置文件設置。maven surefire插件 - 指定單個測試 - 不運行

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.8</version> 
    <configuration> 
     <includes> 
      <include>com.something.test.X.java</include> 
     </includes> 

     <properties> 
      <property> 
       <name>reporter</name> 
       <value>org.testng.reporters.XMLReporter</value> 
      </property> 
      <property> 
       <name>listener</name>       
       <value>Listener</value> 
      </property> 
     </properties> 

     <systemProperties> 
      <property> 
       <name>x.host</name> 
       <value>${server.ip}</value> 
      </property> 
      <property> 
       <name>http_port</name> 
       <value>${http_port}</value> 
      </property> 
      <property> 
       <name>https_port</name> 
       <value>${https_port}</value> 
      </property> 
      <property> 
       <name>jmx_remote_port</name> 
       <value>${jmx_remote_port}</value> 
      </property> 
     </systemProperties> 

     <systemPropertyVariables> 
      <x.host>${server.ip}</x.host> 
      <env.BUILD_NUMBER>${env.BUILD_NUMBER}</env.BUILD_NUMBER> 
      <env.HOSTNAME>${env.HOSTNAME}</env.HOSTNAME> 
     </systemPropertyVariables> 
    </configuration> 

    <executions> 
     <execution> 
      <id>test</id> 
      <phase>integration-test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      <configuration> 
       <skip>false</skip> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

當我運行配置文件時,測試包括不運行! 我在做什麼錯?我甚至用suitexmlfile嘗試過,但是我找不到該類的解析錯誤。

+0

我不確定這會有幫助(現在無法自己測試),但是您可以嘗試在'include'部分僅指定類名而不是全部類名(帶包)。 – 2012-07-24 18:37:44

+0

我確實嘗試過。它不起作用。我基本上想運行其中一個集成測試,而不是全部。我試過使用,-Dtest ....我現在沒有想法:( – 12rad 2012-07-24 19:18:36

+2

啊,我現在看到了。在測試名稱末尾刪除'.java'。 – 2012-07-24 19:22:45

回答

1

正如Andrew Logvinov建議的那樣,您應該從包含的測試名稱中刪除.java。通常,測試座標被指定爲<class-name>[#<method-name>]

相關問題