一部のテストカテゴリを除外/含めるために maven-failsafe-plugin を構成しました。
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<groups>my.company.SomeImportantCategory</groups>
</configuration>
</plugin>
</plugins>
今、私は注釈が付けられていないパラメータ化されたテストを持っていますSomeImportantCategory
:
@RunWith(Parameterized.class)
@Category(AnotherCategory.class)
public class SomeTestIT {
@Parameters(name = "{0}")
public static Collection<TestData[]> setUp() throws Exception {
// Loading Some Excel-Sheets. I'm using github.com/fhm84/jexunit
return doSomethingVeryTimeConsuming("with/this/excel-file.xls");
}
}
次に、このプロファイルを使用して統合テストを実行します。Maven は、テスト ケースを収集するために setUp-Method を実行します。
これをスキップする方法を知っていますか?setUp-Method にアクセスして、含まれている/除外されているグループを読み取り (どのように?!?)、doSomethingVeryTimeConsuming
リフレクションを使用してスキップするなどの Java マジックを実行しても問題ありません。