问题描述
在中,我问了一个小问题一个更大的问题。由于我还没有得到回复,我在这里提出了我的问题:
In this post, I asked a small question as part of a bigger problem. Since I didn't get responses yet, I put my question here:
假设JUnit按顺序执行测试用例是否合理:测试用例在下一个测试用例之前结束开始。它是否在JUnit版本之间有所不同(我的优先级是在JUnit4上)?如果没有,是否有一种简单的方法可以强制JUnit按顺序执行测试?
Is it reasonable to suppose that JUnit executes test cases sequentially: a test case ends befores the next one starts. Does it differ between JUnit versions (my priority is on JUnit4)? And if not, is there a simple way to force JUnit to execute tests sequentially?
谢谢
推荐答案
是的,默认情况下我相信它会按顺序运行测试。
Yes, by default I believe it runs tests sequentially.
JUnit 4.6引入了一个实验 ParallelRunner
并行运行测试 - 我不知道它的当前状态。我希望并行性默认仍然是选择加入功能。 (从其他答案来看,看起来现在这里仍然存在,但形式略有不同 - 仍然选择加入。)
JUnit 4.6 introduced an experimental ParallelRunner
to run tests in parallel - I don't know of its current status. I would expect parallelism to remain an "opt-in" feature by default though. (Judging by other answers, it looks like this is now here to stay but in a slightly different form - and still opt-in.)
这篇关于JUnit是否按顺序执行测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!