默认情况下,Maven Surefire是否按顺序执行测试用例? [英] Does Maven Surefire execute test cases sequentially by default?

查看:132
本文介绍了默认情况下,Maven Surefire是否按顺序执行测试用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对此问题的后续行动深入研究我的研究:

This is a follow up to this question which I realized when I dug deeper into my research:

假设Maven Surefire插件默认情况下按顺序执行测试用例是合理的:一个测试用例在下一个测试用例开始之前就结束了(我对顺序不感兴趣).我发现您可以将Surefire配置为并行运行,这是否意味着顺序执行是默认行为,并且将来可能会出现?

Is it reasonable to suppose that the Maven Surefire plugin executes test cases sequentially by default: a test case ends befores the next one starts (I'm not interested in order). I found that you can configure Surefire to run in parallel, does that mean the sequential execution is the default behavior and will likely be in the future?

NB :如果您要问为什么我要强制测试按顺序运行(我知道,好的测试应该能够并行运行),因为我正在解决涉及Web应用程序覆盖的特定问题的解决方案.您可以在此处中阅读.

谢谢

推荐答案

您的问题的答案包括推测未来,这通常是一件困难的事情.话虽如此,我会猜测是的,这将是默认行为,因为并行执行测试仅对完全隔离的测试有意义,所有外部依赖都被模拟了,否则已搞定.有时很难实现,尤其是在为旧代码创建测试时.在这种情况下,必须将决定权留给程序员,程序员只知道采用并行性是否有意义.

The answer to your question involves speculating about the future, which is usually a difficult thing. Having said that, I'd make a guess that yes, it is going to be the default behaviour, because parallel execution of tests makes sense only for perfectly isolated tests, with all external dependencies mocked, or otherwise taken care of. It is sometimes hard to achieve, especially when creating tests for old code. In such cases the decision must be left to the programmer, who only has the idea whether it makes sense to employ parallelism.

这篇关于默认情况下,Maven Surefire是否按顺序执行测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆