标签:
@Test需要注意以下的几点:@Test(timeout=毫秒)
@Test(expected=ArithmeticException.class) public void testDivide() { assertEquals(3, new Calculate().divide(6, 0)); } @Test(timeout=3000) public void testReadFile(){ try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Ignore("...") @Test(timeout=2000) public void testWhile() { while(true) { System.out.println("run forever..."); } }
@RunWith(Suite.class) @Suite.SuiteClasses({Test1.class,Test2.class,Test3.class}) public SuiteTest{ //要保证类为空类,不能包含任何方法 }
标签:
原文地址:http://blog.csdn.net/wojiaohuangyu/article/details/51742357