小编vpr*_*han的帖子

junit实现多个跑步者

我一直试图通过创建一个扩展跑步者的suiterunner来创建一个个性化的测试套件.在带有注释的测试套件中,@RunWith(suiterunner.class)我指的是需要执行的测试类.

在测试类中,我需要重复一个特定的测试,为此我正在使用这里提到的解决方案:http://codehowtos.blogspot.com/2011/04/run-junit-test-repeatedly.html.但是因为我创建了一个触发测试类的suiterunner并且在我正在实现的测试类中@RunWith(ExtendedRunner.class),所以抛出了初始化错误.

我需要帮助来管理这两个跑步者,还有什么方法可以将两个跑步者组合起来进行特定测试吗?有没有其他方法可以解决这个问题或任何更简单的方法来继续?

java junit annotations suite junit-runner

7
推荐指数
1
解决办法
2425
查看次数

junit有条件的拆解

我希望在我的junit测试用例中有条件拆解,例如

@Test
testmethod1()
{
//condition to be tested
}
@Teardown
{
//teardown method here
}
Run Code Online (Sandbox Code Playgroud)

在拆解我想要有一个像这样的条件

if(pass) 
then execute teardown 
else skip teardown
Run Code Online (Sandbox Code Playgroud)

是这样的场景可能使用junit?

junit conditional teardown

3
推荐指数
1
解决办法
1643
查看次数

标签 统计

junit ×2

annotations ×1

conditional ×1

java ×1

junit-runner ×1

suite ×1

teardown ×1