我的E2E测试运行得相当慢(25分钟),因为它们调用了一堆服务并等待一些数据被填充到数据库中。我想同时运行它。我正在使用以下maven-failsafe-plugin设置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${plugin.failsave.version}</version>
<executions>
<execution>
<id>run-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>我的测试如下所示(如果需要,可以提供更多信息):
@Stepwise
@DataJpaTest
@ContextConfiguration(classes = SomeControllerITConfig)
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class SomeControllerIT extends Specification {
// some variables definition
def "test1":
// some test
def "test2":
// some test
// some more tests
}我尝试将threadCount属性与parallel或forkCount一起使用,但对我来说都不起作用。此外,我还尝试在maven-failsafe-plugin依赖项中强制执行以下依赖项:
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.16</version>
</dependency>提前感谢!
发布于 2017-01-31 17:07:39
我在GitHub上总结了以下问题:
https://github.com/spockframework/spock/issues/691
如果您还对Spock中的并行测试执行感兴趣,请进行注释或其他任何操作。
简而言之,我发现了一个支持并行执行的拉取请求,它甚至被合并到其中一个分支中。然而,它还没有合并到master中。因此,我现在看到的唯一出路就是编写自己的自定义BaseSpecRunner
发布于 2020-11-06 04:06:47
看起来Spock团队增加了对并行执行的支持:
http://spockframework.org/spock/docs/2.0-M4/parallel_execution.html#parallel-execution
需要groovy:>3.0.6
https://stackoverflow.com/questions/41897862
复制相似问题