Introduction on Using Hamcrest Unit Test Framework
来源:互联网 发布:js 定义json对象 编辑:程序博客网 时间:2024/04/30 07:13
Hamcrest is a unit test framework, the assert function assertThat of hamcrest is more human readable comparing to the assert function of Junit, therefore, Junit4 has already adopted and integrated the hamcrest framework from version 4.4 on. Please check following screenshot.
But Junit4 integrates only the core features of hamcrest, in order to facilitate our test automation work, we should add the hamcrest JAR library with all features into our test project.
- Hamcrest-all-xx.jar : Contains all feature of hamcrest
- Hamcreset-core-xx.jar : Contains core feature of hamcrest
We could download hamcrest by following this link:
http://search.maven.org/#search|ga|1|g%3Aorg.hamcrest
Following description would illustrate how to use hamcrest-all in our test project.
Step 1:Drag&drop the hamcrest-all jar package to the libs(Create one if not exist)folder of the project
Step 2: Import hamcrest modules into test script
- “importstatic org.hamcrest.MatcherAssert.assertThat”: in order to use the function“assertThat”
- “import static org.hamcrest.Matchers.*”:in order to use the matcher of“is”,”notNullValue”,”equalTo” and so on.
Step 3: Use hamcrest feature in our test script
Following are the link on the syntax of asserThat function of hamcrest.
http://langgufu.iteye.com/blog/1893927
-----------------------------------------TheEnd--------------------------------------
- Introduction on Using Hamcrest Unit Test Framework
- Unit Test 筆記-introduction
- 【Study Record】Using Google Mocking Framework in Unit Test ( Advanced )
- Javascript unit test framework
- An Introduction to Using Binder Framework on Android Operating System
- [Junit]Understanding unit test framework
- Symbian OS Unit Test Framework
- Create Unit Test on VS
- Using MVC improve UI Unit Test
- Using Mockito to Unit Test Java Applications
- CUnit - A Unit Test Framework For C
- Qt的Unit Test Framework简介
- 一个简单的C++ Unit Test framework
- C++ Unit Test Framework(单元测试框架)
- how to learn unit test mock framework
- Spring Framework : Introduction on broad
- c语言实现一个单元测试框架(Unit Test Framework)
- c语言实现一个单元测试框架(Unit Test Framework)代码
- 锚点跳转
- Mysql 去重
- poj1321变种8皇后
- ZOJ Problem Set - 1649
- python类知识
- Introduction on Using Hamcrest Unit Test Framework
- axis2-----5
- 第一个项目(五)添加跳跃动作
- axis2---5--2
- ios运用fmdb建SQLite数据库
- 在sed命令中使用外部变量
- 【容斥原理+欧拉函数】 HDOJ 1695 GCD
- Lua string库
- qtwebkit插件