有没有办法使Eclipse运行JUnit测试多次,直到失败? [英] Is there a way to make Eclipse run a JUnit test multiple times until failure?
问题描述
有没有一些方便的方法(内置或高品质的插件),使Eclipse运行相同的测试X次,如果出现故障,停止?注意,我正在UI中寻找某些东西(例如,右键单击并说出运行X次而不是仅仅单击Run X times?)
跑)。
如果for循环工作,那么我同意nos。
如果您需要重复整个安装测试 - 拆卸,那么您可以使用TestSuite:
- 右键单击包包含测试重复
- 转到新建并选择创建JUnit测试套件
- 确保只选择要重复的测试并点击完成。
- 编辑文件多次运行。
您刚才发现的文件
addTestSuite(YourTestClass.class)
行,并将其包装在for循环中。
我很确定你可以使用addTest而不是addTestSuite让它只运行一个测试,如果你只想重复一个测试方法。
We occasionally have bugs that appear once in every X runs. Before people check in stuff (where it is automatically JUnit'd), our devs need to pass JUnit locally via Eclipse.
Is there some convenient way (built in or high-quality Plugin) to make Eclipse run the same test X times and stop if there's a failure? An alternative to just clicking Run X times?
Note that I'm looking for something in the UI (e.g., right click and say "Run X times" instead of just "Run").
If the for loop works, then I agree with nos.
If you need to repeat the entire setup-test-teardown, then you can use a TestSuite:
- Right-click on the package containing the test to repeat
- Go to New and choose to create a JUnit test SUITE
- Make sure that only the test you want to repeat is selected and click through to finish.
- Edit the file to run it multiple times.
In the file you just find the
addTestSuite(YourTestClass.class)
line, and wrap that in a for loop.
I'm pretty sure that you can use addTest instead of addTestSuite to get it to only run one test from that class if you just want to repeat a single test method.
这篇关于有没有办法使Eclipse运行JUnit测试多次,直到失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!