2013-01-03 32 views

回答

17

您可以這樣做,如下所示:

您的pom.xml應包含以下設置。

<configuration> 
    <excludes> 
     <exclude>**/TestCircle.java</exclude> 
     <exclude>**/TestSquare.java</exclude> 
    </excludes> 
</configuration> 

如果你想正則表達式的支持只是使用

<excludes> 
    <exclude>%regex[.*[Cat|Dog].*Test.*]</exclude> 
</excludes> 

http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

如果你想使用類別標註,你需要做到以下幾點:

@Category(com.myproject.annotations.Exclude) 
@Test 
public testFoo() { 
    .... 
} 

在你maven配置,你可以有這樣的東西

<configuration> 
    <excludedGroups>com.myproject.annotations.Exclude</excludedGroups> 
</configuration> 
+1

如何在命令行中執行此操作? –

+1

@AnatoliiStepaniuk使用-DexcludedGroups = – kazanaki

+0

我找不到任何引用'excludedGroups' for surefire – Hafiz

相關問題