软件测试(Software Testing)Lab1: Junit

1. Install JUnit, Hamcrest, eclemma.

  I use IntelliJ IDEA IDE instead of Eclipse. Now I report the step to install the JUnit in IDEA. First of all, we should download the jar package from the website, we choose the junit-4.12.jar. After we create a new project, we click “file” menu, choose the “project structure”, and then, we choose “Modules” at the left menu, select “Dependencies” at the right menu, after that we click “<Module source>” and click “+” to add the junit-4.12.jar into project.

  The same way, we can easily add the hamcrest-all-1.3.jar add into project.

  We don’t need add the eclemma into the IDEA, because IDEA have a selection is “Run with Coverage”. On the other hand, we can’t add eclemma into IDEA, because it is a plugin for Eclipse IDE.

  More details in the following picture.

 

2. result

  This is the structure of my project.

  This is my code to judge a triangle.

  This is my test class.

  After we run the test, we can get like the following result.

  Then we can get the coverage after “run with the coverage”.

  The green besides the line number means this line is been covered.

 

转载于:https://www.cnblogs.com/lmns/p/6538277.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值