Lab1 report

A) The brief description that you install junit, hamcrest and eclemma.

a)  install junit、hamcrest:
方式一:导入jar包。
1、鼠标右击项目名,点击‘Properties’一栏;
2、如下图点击‘Add External JARs’;

3、选中下载好的junit和hamcrest的jar包,打开即可。

方式二,添加junit库:
1、鼠标右击项目名,点击‘Properties’一栏;
2、如下图点击‘Add Library’;

3、选中Junit一栏,点击‘Next’;

4、选择Junit版本,之后点击‘Finish’。

b) install eclemma
1、下载jacoco,链接: http://www.eclemma.org/jacoco/ 根据系统选择适合的版本即可;
2、下载完成后,解压文件,将lib目录下的所有jar包放入eclipse安装目录的‘plugins’文件夹下;

3、在eclipse窗口依次点击HelpàEclipse
Marktplaceà在‘Find’一栏输入:eclemmaà点击安装即可。

B)
The test result and coverage report (print screen) of your tests on
triangle problem.

test result:

coverage report:

source codes:

TriangleProblem.java:

 package cn.tju.triangleproblem;

 public class TriangleProblem {

     public TriangleProblem() {
// TODO Auto-generated constructor stub
} public String TriangleTypes(int a, int b, int c) { if (a + b > c && b + c > a && c + a > b) {
if (a == b && b == c)
return "equilateral";
if (a == b || b == c || c == a)
return "isosceles"; return "scalene";
} else
return "Error, not a triangle!"; } }

  TriangleProblemTest.java:

  

 package cn.tju.triangleproblem;

 import static org.junit.Assert.*;

 import java.util.Arrays;
import java.util.Collection; import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class)
public class TriangleProblemTest {
private String expectResult = "";
private int edgeA, edgeB, edgeC;
private TriangleProblem tp; public TriangleProblemTest(String expectResult, int edgeA, int edgeB,
int edgeC) {
super();
this.expectResult = expectResult;
this.edgeA = edgeA;
this.edgeB = edgeB;
this.edgeC = edgeC;
} @Before
public void setUp() {
tp = new TriangleProblem();
} @Test
public void testTriangleTypes() {
assertEquals(this.expectResult,
tp.TriangleTypes(this.edgeA, this.edgeB, this.edgeC));
} @Parameters
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] { { "equilateral", 6, 6, 6 },
{ "isosceles", 9, 9, 8 }, { "scalene", 4, 5, 6 },
{ "Error, not a triangle!", 3, 6, 9 }});
} }

Lab1 Report的更多相关文章

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

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

  2. ucore操作系统学习笔记(一) ucore lab1系统启动流程分析

    一.ucore操作系统介绍 操作系统作为一个基础系统软件,对下控制硬件(cpu.内存.磁盘网卡等外设),屏蔽了底层复杂多样的硬件差异:对上则提供封装良好的应用程序接口,简化应用程序开发者的使用难度.站 ...

  3. 2.ASP.NET MVC 中使用Crystal Report水晶报表

    上一篇,介绍了怎么导出Excel文件,这篇文章介绍在ASP.NET MVC中使用水晶报表. 项目源码下载:https://github.com/caofangsheng93/CrystalReport ...

  4. Monthly Income Report – August 2016

    原文链接:https://marcoschwartz.com/monthly-income-report-august-2016/ Every month, I publish a report of ...

  5. Step by step Install a Local Report Server and Remote Report Server Database

    原创地址:http://www.cnblogs.com/jfzhu/p/4012097.html 转载请注明出处 前面的文章<Step by step SQL Server 2012的安装 &g ...

  6. Session for SSRS Report of Microsoft Dynamics AX

    Session for SSRS Report of Microsoft Dynamics AX 版权声明:本文为博主原创文章,未经博主允许不得转载. Contract •A data contrac ...

  7. Report processing of Microsoft Dynamic AX

    Report processing of Microsoft Dynamic AX 版权声明:本文为博主原创文章,未经博主允许不得转载. The implementation of a general ...

  8. Utility3:Understand Dashboard Report

    To see data in the SQL Server Utility dashboard, select the top node in the Utility Explorer tree - ...

  9. PowerDesigner导出Report通用报表

    PowerDesigner导出Report通用报表 通用模板下载地址:http://pan.baidu.com/s/1c0NDphm

随机推荐

  1. [转]c3p0学习-JdbcUtil工具类

    原文:https://www.cnblogs.com/jonny-xu/p/6374163.html 一.需要jar包: c3p0-0.9.1.2.jar mysql-connector-java-5 ...

  2. JAVA 基础编程练习题31 【程序 31 数组逆序】

    31 [程序 31 数组逆序] 题目:将一个数组逆序输出. 程序分析:用第一个与最后一个交换. package cskaoyan; public class cskaoyan31 { @org.jun ...

  3. 操作TreeView(咏南工作室)

    {*******************************************************}{                                           ...

  4. Win10 企业版 激活 批处理

    cd %SystemRoot%\System32 wscript.exe slmgr.vbs /upk wscript.exe slmgr.vbs /ipk NPPR9-FWDCX-D2C8J-H87 ...

  5. TOMCAT 安装教程 & 配置CGI & c语言exe

    TOMCAT安装 参考原文网址:百度经验http://jingyan.baidu.com/article/154b4631aad2bb28ca8f4191.html 1.下载安装JDK 网址:http ...

  6. NDK学习笔记-gdb调试

    在做开发的时候,难免会crash,那么在这时候需要进行调试,在C/C++的代码调试中,gdb是很常用的gdb在这不做过多介绍,之前在C语言中已经做过总结,这里简要回顾一下 要使用gdb,在编译的时候需 ...

  7. shell 入门学习

    目录 shell 入门学习 注释 执行与启动 变量 语法 调试 title: shell 入门学习 date: 2019/7/16 15:47:49 toc: true --- shell 入门学习 ...

  8. [Agc030B]Tree Burning_贪心

    Tree Burning 题目链接:https://atcoder.jp/contests/agc030/tasks/agc030_b 数据范围:略. 题解: 开始以为是左右左右这样,发现过不去样例. ...

  9. PTA(Basic Level)1020.月饼

    月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼.现给定所有种类月饼的库存量.总售价.以及市场的最大需求量,请你计算可以获得的最大收益是多少. 注意:销售时允许取出一部分库存.样 ...

  10. [转帖]Linux日期和时间的那些事儿

    Linux日期和时间的那些事儿 http://embeddedlinux.org.cn/emb-linux/entry-level/201311/09-2672.html 自己还是稚嫩啊.. 除了年龄 ...