首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

JUnit4 中@AfterClass @BeforeClass @after @before的差别对比

2012-06-26 
JUnit4 中@AfterClass @BeforeClass @after @before的区别对比junit4和junit3有一定的区别,在junit3中,测

JUnit4 中@AfterClass @BeforeClass @after @before的区别对比
junit4和junit3有一定的区别,在junit3中,测试方法必须以test开始,即方法为testXXX(),在junit4中没有这个限制。因为在junit4中可以利用注解(annotation)@Test来指定测试方法。但是,在junit4中不用继承TestCase父类,如果使用继承,则junit4的注解将会失效。 junit4不继承TestCase,自然不能直接使用assertEqual等方法,如果要使用断言必须直接静态引用,即 Assert.assertEqual(int ,int  ) 这种方式。



热点排行