为了微调在哪些时间以及在哪些环境中运行哪些测试,我们为maven-surefire-plugin设置了几个执行.我们将默认配置设置为跳过所有测试,然后为我们想要的执行启用它们.这本身对我们很有用.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*Tests.java</include>
</includes>
<excludes>
<exclude>**/*IntegrationTests.java</exclude>
</excludes>
</configuration>
<execution>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
</configuration>
<execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
当我将maven-cobertura-plugin添加到混合中时,我遇到了问题.cobertura目标运行,并成功地完成我的课程.但是,没有测试运行.我假设这是因为cobertura运行的测试执行是跳过的.但是,我找不到如何指定为此执行设置的阶段和目标.当我打开所有测试时,输出似乎表明这些仍然在这些单元测试和集成测试阶段/目标中运行.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我如何指定一个surefire执行,以便cobertura将针对检测类运行它?
我正在尝试对Postgres 9.2数据库运行CREATE INDEX CONCURRENTLY命令.我实现了MigrationResolver,如问题655所示.当此迁移步骤通过mvn flyway:migrate或类似运行时,该命令将启动但在等待模式下挂起.
我验证了该命令是通过pg_stat_activity表执行的:
test_2015_04_13_110536=# select * from pg_stat_activity;
datid | datname | pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | xact_start | query_start | state_change | waiting | state | query
-------+------------------------+-------+----------+----------+------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+---------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
21095 | test_2015_04_13_110536 | 56695 | 16385 | postgres | psql | | | -1 | 2015-04-13 11:10:01.127768-06 | 2015-04-13 11:13:08.936651-06 | 2015-04-13 11:13:08.936651-06 | 2015-04-13 11:13:08.936655-06 | f | active …Run Code Online (Sandbox Code Playgroud)