我已經在我的POM定義了以下配置萬無一失使用TestNG:什麼是「默認測試」代表在Maven的萬無一失插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<skipTests>${skip-all-tests}</skipTests>
</configuration>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>${skip-unit-tests}</skip>
<groups>unit</groups>
<excludedGroups>integration</excludedGroups>
</configuration>
</execution>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>${skip-integration-tests}</skip>
<groups>integration</groups>
<excludedGroups>unit</excludedGroups>
</configuration>
</execution>
</executions>
</plugin>
但似乎兩次執行總是被先一個似乎運行每個@test註釋方法的「默認測試」運行(至少我認爲是這樣)。
--- maven-surefire-plugin:2.12:test (default-test) @ my-project
例如其上運行的項目「MVN測試」,兩個測試執行發生。 「默認測試」和「單元測試」。
有人可以解釋這一點對我更多一點嗎? 這可以禁用或控制(配置什麼測試,什麼不是)?
看看你的生成的pom通過mvn help:effective-pom。此外,定義這種事情的最佳方式是將其放入pluginManagement,並且您應該通過maven-failsafe-plugin和不通過maven-surefire-plugin運行集成測試。 – khmarbaise 2012-08-13 14:45:47
謝謝,這已經爲我清除了很多!如果你把你的評論放在答案中,我會給你獎勵。 – 2012-08-14 08:46:56