首先安装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. 6.7 使用IDEA导入工程

    打开IDEA->File->new -> Project from existing ..->选择你的工程,导入: 请注意,在130或者40上面的项目并不是最新的,sunny也 ...

  2. java8 创建树结构的数据

    private List<TreeNode> createTree(Integer pid, Map<Integer, List<SysPermission>> m ...

  3. App知识点汇总

    1.Fragment 2.AndroidStudio 用夜神安卓模拟器调试 进入夜神模拟器安装目录下的bin目录,执行nox_adb.exe connect 127.0.0.1:62001,Andro ...

  4. 为什么源码中很多方法就一行throw new RuntimeException("Stub!")

    在使用某些类的方法时,发现其内部就一行throw new RuntimeException("Stub!"),但是实际运行中并没有抛出该错误,该方法也并没有语法报错. 因此可能是系 ...

  5. Git error: unable to create file xxx: Filename too long

    一.问题描述 在使用 git 时,提示 error: unable to create file xxx: Filename too long error: unable to create file ...

  6. nkv客户端性能调优

    此文已由作者张洪箫授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 问题描述 随着考拉业务的增长和规模的扩大,很多的应用都开始重度依赖缓存服务,也就是杭研的nkv.但是在使用过 ...

  7. 51nod1024(math+set)

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1024 题意:中文题诶- 思路:要是能求出a^b的值来就好了. ...

  8. 使用idrac远程管理卡操作安装Centos

    浏览器打开远程管理网卡地址(浏览器建议用IE,本次用的IE11,其他浏览器可能不能用) 1.首先设置虚拟控制台插件类型(推荐该为本地) 点击启动后,可能会弹窗,选择允许 2.添加镜像 创建虚拟介质 连 ...

  9. myclipse运行web的一些问题

    一.修改项目访问路径 项目右键>properties(属性)>输入web搜索>双击web>修改Web-Content root内容即可 二. myeclipse中web项目不自 ...

  10. CF447B DZY Loves Strings 贪心

    DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter ...