JUnit 是否按顺序执行测试用例? [英] Does JUnit execute test cases sequentially?

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

问题描述

在这个帖子中,我问了一个小问题作为一部分一个更大的问题.由于我还没有收到回复,我把我的问题放在这里:

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 是否按顺序执行测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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