我有一些依赖于测试数据的集成测试。此测试数据在阶段创建pre-integration-test
并在阶段删除post-integration-test
。
-DskipITs
我的问题是,如果我在 Maven 命令行上使用,这些阶段仍然会执行。
有什么方法-DskipITs
可以跳过预集成测试和集成测试后阶段?
这是 pom 中的插件定义:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
<configuration>
<driver>com.mysql.jdbc.Driver</driver>
<url>${database.url}</url>
<username>${database.user}</username>
<password>${database.pw}</password>
</configuration>
<executions>
<execution>
<id>create-integration-test-data</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>descending</orderFile>
<fileset>
<basedir>${basedir}/src/test/resources/sql</basedir>
<includes>
<include>AdministrationTestTeardown.sql</include>
<include>AdministrationTestSetup.sql</include>
</includes>
</fileset>
</configuration>
</execution>
<execution>
<id>remove-data-after-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<fileset>
<basedir>${basedir}/src/test/resources/sql</basedir>
<includes>
<include>AdministrationTestTeardown.sql</include>
</includes>
</fileset>
</configuration>
</execution>
</executions>
</plugin>