在Eclipse中,如何多次运行JUnit测试用例 [英] In Eclipse, how do I run a JUnit test case multiple times
本文介绍了在Eclipse中,如何多次运行JUnit测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个单元测试有时失败,调试是一个痛苦,因为我不知道为什么有时会失败。
I have a unit test that fails sometimes and debugging it is a pain because I don't know why it sometimes fails.
Eclipse中有一种方法我可以运行一个JUnit测试5次或50次或者什么?
Is there a way inside Eclipse that I can run a JUnit test 5 times or 50 times or something?
谢谢。
推荐答案
有一个测试装饰器。请参阅Junit API
http://junit.org/apidocs/junit/extensions /RepeatedTest.html
There is a test decorator for this. See Junit API at http://junit.org/apidocs/junit/extensions/RepeatedTest.html
例如
@Test
@Repeat(10)
public void FailRandomlyNeedToKnowWhy() {
....
}
这篇关于在Eclipse中,如何多次运行JUnit测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文