首先安装eclipse

然后下载hamcrest-core-1.3.jar,下载地址:http://mvnrepository.com/artifact/org.hamcrest/hamcrest-core/1.3

下载junit-4.12.jar,下载地址:http://mvnrepository.com/artifact/junit/junit/4.12

然后安装Eclemma,打开eclipse,点击Help->Eclipse Market Place

安装重启eclipse即可,若出现图标即表示安装成功。

创建一个project,格式如下

package Triangle;

public class Triangle {
public int isTriangle(int a,int b,int c){
if(a>0 && b>0 && c>0 && a+b>c && a+c>b && b+c>a){
return 1;
}
return 0;
}
public int equilateral(int a,int b,int c){
if(isTriangle(a,b,c)==1){
if(a==b && b==c){
return 1;//等边
}
}
return 0;
}
public int isosceles(int a,int b,int c){
if(isTriangle(a,b,c)==1){
if(a==b || b==c || a==b){
return 1;//等腰
}
}
return 0;
}
public int scalene(int a,int b,int c){
if(isTriangle(a,b,c)==1){
if(a==b || b==c || a==b){
return 0;//等腰
}
return 1;
}
return 0;
}
}
package Triangle;
import static org.junit.Assert.*;
import org.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith; public class TestTri {
Triangle tri=new Triangle(); @Test
public void testisTriangle(){
assertEquals(1,tri.isTriangle(1,1,1));
}
@Test
public void testequilateral(){
assertEquals(1,tri.equilateral(1,1,1));
}
@Test
public void testisosceles(){
assertEquals(1,tri.isosceles(1,1,1));
}
@Test
public void testscalene(){
assertEquals(1,tri.scalene(1,1,1));
}
}

测试结果:

软件测试Lab 1 Junit and Eclemma的更多相关文章

  1. 软件测试:lab1.Junit and Eclemma

    软件测试:lab1.Junit and Eclemma Task: Install Junit(4.12), Hamcrest(1.3) with Eclipse Install Eclemma wi ...

  2. Software Testing Techniques LAB 01: test Junit and Eclemma

    1. Installing  1. Install Junit and hamcrest First, I download the Junit-4.12.jar and hamcrest-core- ...

  3. 单元测试系列:如何使用JUnit+JaCoCo+EclEmma完成单元测试

    更多原创测试技术文章同步更新到微信公众号 :三国测,敬请扫码关注个人的微信号,感谢!   原文链接:http://www.cnblogs.com/zishi/p/6726664.html -----如 ...

  4. 软件测试第一次试验JUnit

    一.Junit, hamcrest以及eclemma的安装 对于Junit和hamcrest的安装,我并没有从下载Junit和hamcrest相关的jar包然后通过build path导入到项目中,而 ...

  5. 使用junit和eclemma进行简单的代码测试

    1.Junit和Hamcrest的安装 可以在https://mvnrepository.com/上面下载所需要的Junit和Hamcrest的jar包,然后在项目中新建一个lib文件夹,将下载好的j ...

  6. 软件测试入门 1—— junit 单元测试

    一.实验主要内容: 1. 2.EclEmma安装 见: http://www.cnblogs.com/1995hxt/p/5291465.html 二.对与 Junit 安装,使用 maven管理项目 ...

  7. 软件测试作业3 — PrintPrimes()

    一.Use the following method printPrimes() for questions a–d. (a) Draw the control flow graph for the p ...

  8. 软件测试-homework3

    printPrime()代码: public static void printPrimes (int n) { int curPrime; // Value currently considered ...

  9. 软件测试技术作业3---PrintPrimes()

    一.代码部分: private static void printPrimes (int n) { int curPrime; // Value currently considered for pr ...

随机推荐

  1. 树莓派 Learning 003 --- GPIO 000 --- GPIO引脚图

    树莓派 Learning 003 - GPIO 000 - GPIO引脚图 我的树莓派型号:Raspberry Pi 2 Model B V1.1 装机系统:NOOBS v1.9.2 Raspberr ...

  2. 手机连接fiddler后,浏览器无法打开网页或者fiddler抓取不到手机应用相关数据的情况

    关于手机如何连接fiddler,网上有很多教程,我暂时就不写了 今天在使用fiddler的过程中,发现fiddler突然无法抓取移动端应用的数据包,再三确认连接无误.因此就开始了解决之旅 起因是安卓手 ...

  3. 6.【应急响应】Linux入侵排查思路

    0x01 入侵排查思路 一.账号安全 基本使用: 1.用户信息文件/etc/passwd root:x:0:0:root:/root:/bin/bash account:password:UID:GI ...

  4. BZOJ 1012【线段树】

    题意: Q L 询问数列最后 L 个数中最大的数. A n 将 n + t ( t_init = 0 ), 然后插到最后去. 思路: 感觉动态地插入,很有问题. 数组地长度会时常变化,但是可以先预处理 ...

  5. (PHP)redis String(字符串)操作

    /** * * String操作 * 字符串操作 * */ //设置键值:成功返回true,否则返回false,键值不存在则新建,否则覆盖 $redis->set('string', 'hell ...

  6. 洛谷P1053 篝火晚会

    P1053 篝火晚会 题目描述 佳佳刚进高中,在军训的时候,由于佳佳吃苦耐劳,很快得到了教官的赏识,成为了“小教官”.在军训结束的那天晚上,佳佳被命令组织同学们进行篝火晚会.一共有n个同学,编号从1到 ...

  7. InfoQ —— 百度搜索速度优化

    本篇源自InfoQ —— <百度搜索速度优化> 好多名词不了解... 相关文档下载链接 背景 许霞,毕业于浙江大学.08年加入百度运维部. 本篇讲座主要讲述百度关于速度的优化,包括PC端和 ...

  8. NodeJS什么都能做,为什么还要JAVA?

    这张图看起来简单而且很好理解,但没尝试过,会有很多疑问. SPA模式中,后端已供了所需的数据接口,view前端已经可以控制,为什么要多加NodeJS这一层? 多加一层,性能怎么样? 多加一层,前端的工 ...

  9. php使用百度地图API

    首先注册百度开发者平台账号,创建应用获取AK 不同的应用功能不同,一定要注意,没有的功能调用会提示APP被禁用 根据开发文档使用 给出例子:百度地图WEB api http://lbsyun.baid ...

  10. codeforces round 472(DIV2)D Riverside Curio题解(思维题)

    题目传送门:http://codeforces.com/contest/957/problem/D 题意大致是这样的:有一个水池,每天都有一个水位(一个整数).每天都会在这一天的水位上划线(如果这个水 ...