我的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>
提前致谢!
我最终在GitHub上遇到以下问题:
https://github.com/spockframework/spock/issues/691
发表评论,或者如果您也对Spock中的并行测试执行感兴趣的话。
简而言之,我发现了一个启用并行执行的请求请求,甚至将其合并到分支之一中。但是,它尚未合并到主服务器中。因此,我目前看到的唯一出路是编写自己的自定义BaseSpecRunner
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句