码迷,mamicode.com
首页 > 其他好文 > 详细

Junit的套件使用

时间:2017-02-03 18:04:41      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:sse   exce   测试用例   oid   pre   rdo   cut   内容   after   

定义一个类,在类的上方添加@RunWith(Suite.class)和@SuiteClasses({XX.class,YY.class,...})

实例
有两个类分别为:
public class Login{
@Before
public void setUp() throws Exception{
......
}

@Test
public void test(){
......
}

@After
public void tearDown() throws Exception{
......
}
}


public class Logout{
@Before
public void setUp() throws Exception{
......
}

@Test
public void test(){
......
}

@After
public void tearDown() throws Exception{
......
}
}
想要同时运行这两个Junit测试用例,则可以如下
@RunWith(Suite.class)
@SuiteClasses({
  Login.class,//登录
  Logout.class//登出
})
public class Control{
  @test
  public void execute(){
//内容可以为空。
}
}

Junit的套件使用

标签:sse   exce   测试用例   oid   pre   rdo   cut   内容   after   

原文地址:http://www.cnblogs.com/woniu123/p/6363141.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!