mavenとのSpring Bootテスト統合機能を使いたいです。私は、次のコマンドを実行すると、私は期待どおりに動作していないことを参照してください。それが開始されMaven-failsafe-plugin:skipTests設定がSpring Boot 1.4統合テストでは機能しません
mvn clean install -DskipIntegrationTests=true
統合テストを実行するが、それらをスキップする必要があります。 私の質問は次のとおりです:
- どうすればmavenで統合テストの実行を制御できますか?
- 本当にmaven-failsafe-pluginが必要ですか?
注:私は春のブートを使用しています1.4.0.RELEASE マイPOM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipTests>${skipIntegrationTests}</skipTests>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
私の統合テスト:
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("development")
@SqlGroup({
@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:beforeTestRun.sql"),
@Sql(executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, scripts = "classpath:afterTestRun.sql")
})
public class AdminTest {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void get_all_admins() {
//TODO: code here
}
}
通常のユニットテストと比較して、そのテストを「統合テスト」としてどのように識別していますか? –
私は識別しません、おそらく私はいくつかのmavenプラグインの設定が欠けていました – Dimon