2014-02-17 42 views
3

在某些情況下,我想跳過一些 junit測試在構建時Atlassian Bamboo在某些時候。可能嗎?如何在構建時跳過一些 junit測試?如何在構建時跳過一些junit測試

你有另一個建議嗎?

Atlassian的竹版本5.3

+1

如果你傳遞'-Dmaven.test.skip = true',它甚至不會編譯測試;因爲一般來說這不是一個好主意,你應該有充分的理由來證明這一點。 –

+0

這將跳過所有測試 – tddmonkey

+1

查看詳細的答案在這裏 - http://stackoverflow.com/a/9138298/508214 – titogeo

回答

0

是否總是相同的測試集要跳過?如果是這樣你可以控制它通過Maven的配置文件,並使用包含/排除配置參數僅執行你想要什麼

0

註釋@Ignore添加到您想跳過

0

您可以配置此測試您的使用surefire插件的pom.xml。例如,以下內容會導致任何帶有「IT」後綴的測試被跳過。

<plugin> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.16</version> 
    <inherited>true</inherited> 
    <configuration> 
     <skip>true</skip> 
    </configuration> 
    <executions> 
     <execution> 
     <id>unit-tests</id> 
     <phase>test</phase> 
     <goals> 
      <goal>test</goal> 
     </goals> 
     <configuration> 
      <skip>false</skip> 
      <excludes> 
      <exclude>**/*IT.java</exclude> 
      </excludes> 
     </configuration> 
     </execution> 
    </executions> 
    </plugin>