问题描述
我有一个多项目构建,其中包含子项目和父项目中的测试.构建被聚合,以便父项目运行子项目中的所有测试.
I have a multi-project build with tests in sub-projects and in a parent project. The build is aggregated so that the parent project runs all tests in child projects.
我对其进行了配置,以便通过
I configured it so that there's no parallel execution of tests in both the sub-projects and the parent project, via
parallelExecution in Test := false
但是,我有一种烦人的感觉,即跨越多个项目的测试是并行运行的.对于其中一个子项目,这是一个问题,因为它同时改变了测试数据库中的状态,导致测试失败.
However, I have the nagging feeling that tests that span over multiple projects are ran in parallel. In the case of one of the sub-projects this is a problem because it mutates state in a test database concurrently, leading to the test to fail.
关于如何在项目之间全局切换并行执行测试有什么想法吗?
Any ideas as to how to globally switch of parallel execution of tests, between projects?
推荐答案
我认为您可以使用范围 ThisBuild
跨项目应用设置,例如
I think you can apply a setting across projects using scope ThisBuild
, like
parallelExecution in ThisBuild := false
我不知道您是否可以将其与范围 Test
结合使用,但可能没有必要.
I don't know if you can combine that with scope Test
, but it might not be necessary.
这篇关于如何关闭多项目构建测试的并行执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!