태그 : test
カレントにpom.xmlのある状態で
mvn test
を実行する。実行すると src/test/java 以下の
にマッチするファイルをJunitのテストとして実行する。なお
はデフォルトで無視する。
mvnコマンドに、 -Dmaven.test.skip=true を加える。
また、settings.xmlに定義して常にテストフェーズをスキップする。
<settings>... <profiles> <profile> <id>notTest</id> <properties> <maven.test.skip>true</maven.test.skip> </properties> </profile> </profiles> <activeProfiles> <activeProfile>notTest</activeProfile> </activeProfiles></settings>
mvn test -Dtest=テストクラス名
mvn testコマンドに-Dtest=FooBarTest?のようにテストクラスを指定する。-Dtest=*UtilTest?,*DaoTest?のように、カンマ区切りの正規表現でも指定できる。
また、デフォルトのフィルタ設定を変更したい場合は、maven-surefire-pluginを利用して設定を記述する。pom.xmlに以下を追記。
<build>... <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <includes> <include>**/*Test.java</include> </includes> </configuration> </plugin> </plugins> </pluginManagement></build>
# by | 2007/10/18 12:35 | 기타 | 트랙백 | 덧글(0)
◀ 이전 페이지 다음 페이지 ▶