首页 > 其他 > 详细

Junit hamcrest and eclemma 的安装

时间:2016-05-08 13:17:18      阅读:138      评论:0      收藏:0      [点我收藏+]

junit: 用Eclipse安装junit安装其实很简单,就是在项目中倒入两个包就可以,但是我想用maven来在eclipse中建立项目,但是可能是eclipse的版本太低所以不能使用junit4,所以我选择了使用IDEA来做,首先就是用IDEA中maven来建立项目,并且在pom.xml文件中  加入junit 的包依赖: <dependency>
                             <groupId>junit</groupId>
                             <artifactId>junit</artifactId>
                               <version>4.12</version>
                           <scope>test</scope>
                            </dependency>

这样就直接安装好了junit。

hamcrest的安转就更简单了,直接在使用的类文件加上import static org.hamcrest.Matchers.*;就可以使用了

IDEA的覆盖测试呢不需要eclemma安装,直接在EDIT configuration中添加就可以。

用边长度分别为(1,1,1)  (1,1,0)  (2,3,4)进行测试,测试结果都通过,并且覆盖率达到100%

 

Junit hamcrest and eclemma 的安装

原文:http://www.cnblogs.com/wxbsoftware/p/5470317.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!