java junit

Failure和Error

1.Failure是指测试失败

2.Error是指测试程序本身出错

JUnit4Annotation

1.@Test:测试方法

a)(expected=XXException.class)

b)(timeout=xxx)

expected指的是,跑出的异常为什么

timeout 测试效率,指的是希望多少时间,执行完这个方法

2.@Ignore:被忽略的测试方法

3.@Before:每一个测试方法之前运行

4.@After:每一个测试方法之后运行

5.@BeforeClass:所有测试开始之前运行

6.@AfterClass:所有测试结束之后运行

/*

* 使用最新的junit 包* junit网站下载* 引入包在bulid path -> add external archilve* 中引入包* 其中asserthat 是一种更接近自然语法的判断* 当然需要在引入包hamcrest 包* 去官网下载该包,并引入外部包* 就可以使用assertThat方法了** hamcrest的匹配方法更自然*/经验是由痛苦中粹取出来的

java junit

相关文章:

你感兴趣的文章:

标签云: