首先安装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. hadoop-2.3.0-cdh5.1.0完全分布式搭建(基于centos)

    先参考:<hadoop-2.3.0-cdh5.1.0伪分布安装(基于centos)> http://blog.csdn.net/jameshadoop/article/details/39 ...

  2. 滴水穿石 C#中多线程 委托的使用

    什么是多线程?我们在建立以个C#项目时,往往会在Form1上添加控件,然后写代码,初 学者都是在重复这个过程,其实这个过程是单线程的,可以理解为只有“main”主线程,有 的时候往往需要同时测量多个东 ...

  3. Boost Python官方样例(二)

    返回值 使用return_by_value有点像C++ 11的auto关键字,可以让模板自适应返回值类型(返回值类型必须是要拷贝到新的python对象的任意引用或值类型),可以使用return_by_ ...

  4. Zookeeper安装和部署

    Zookeeper安装和部署:ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用 ...

  5. [CentOS7] at, bash, cron, anacron

    声明:本文主要总结自:鸟哥的Linux私房菜-第十五章.例行性工作排程(crontab),如有侵权,请通知博主 at => /var/spool/at /etc/at.allow, /etc/a ...

  6. select下拉框如何与接口配合动态生成option选项

    前几天在做任务时考虑到这个问题,具体任务用例如下: HTML: JS:

  7. vue -- 项目调试

    方式1:vue-devtools插件 vue-devtools是一款基于chrome游览器的插件,用于调试vue应用,这可以极大地提高我们的调试效率. 使用步骤 1. 到github下载:https: ...

  8. Java8 使用 stream().filter()过滤List对象(查找符合条件的对象集合)

    内容简介 本文主要说明在Java8及以上版本中,使用stream().filter()来过滤一个List对象,查找符合条件的对象集合. List对象类(StudentInfo) public clas ...

  9. nginx 安装遇到的问题

    今天想学学 nginx,于是先把它安装起来.按照 http://nginx.org/en/linux_packages.html 上面的方法,在我的 ubuntu 虚拟机上很容易地就安装好了.可是要运 ...

  10. 【转载】Hyperledger学习小结

    Hyperledger学习小结 自学Hyperledger Composer也有段时间了,是时候对所学的知识总结一下了.因为没有实际项目参与的话,差不多也就到此为止了.后续可能会去了解一下以太坊的技术 ...