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-1.3.jar

Then. I add them into eclipse library


After installing,

2. Installing eclemma
Installing with Eclipse Marketplace

2. Testing
- Coding
Write a java program for the triangle problem, which can calculate whether the triangle is equilateral, isosceles or scalene.
package newTest;
public class Triangle {
public int a;
public int b;
public int c;
public Triangle(){
}
public Triangle(int a, int b, int c){
this.a=a;
this.b=b;
this.c=c;
}
public String calculate(){
if ( a + b <= c || b + c <= a || c + a <= b ){
return "Not a triangle";
}
else if( a == b && a == c ){
return "equilateral";
}
else if( a == b || a == c || b == c ){
return "isosceles";
}
else{
return "scalene";
}
}
}
2. Creating Junit test case


Then, finish the test case
package newTest; import static org.junit.Assert.*; import org.junit.Before;
import org.junit.Test; public class TriangleTest { public Triangle tri; @Before
public void setUp() throws Exception {
} @Test
public void testCalculate() {
tri = new Triangle(1,1,1);
assertEquals("equilateral",tri.calculate());
tri = new Triangle(2,2,3);
assertEquals("isosceles",tri.calculate());
tri = new Triangle(2,2,1);
assertEquals("isosceles",tri.calculate());
tri = new Triangle(3,4,5);
assertEquals("scalene",tri.calculate());
tri = new Triangle(3,5,9);
assertEquals("Not a triangle",tri.calculate());
} }
3. Testing and debug
Run the Junit test case, I found some Failures, then I correct them.



The last is Coverage Testing with Eclemma

Software Testing Techniques LAB 01: test Junit and Eclemma的更多相关文章
- Software Testing Techniques LAB 02: Selenium
1. Installing 1. Install firefox 38.5.1 2. Install SeleniumIDE After installing, I set the view o ...
- Software Testing Techniques Homework 3
1. a.This is the chart b. initial numPrimes = 4, t1 would over the loop. c. t = ( n = 1) d. node cov ...
- Software Testing Techniques Homework 2
Problem 1 1. The fault is i > 0, it should be i >= 0, because if the case is x = [0], y= 0, w ...
- Software Testing Techniques Homework 1
I have met some errors in recent years, one of them which impress me most. It happend when I try to ...
- 读书笔记-Software Testing(By Ron Patton)
Software Testing Part I:The Big Picture 1.Software Testing Background Bug's formal definition 1.The ...
- Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques
Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques Jan 04, 2017, Vers ...
- 101+ Manual and Automation Software Testing Interview Questions and Answers
101+ Manual and Automation Software Testing Interview Questions and Answers http://www.softwaretesti ...
- Exploratory Software Testing
最近找到去年上半年看过一本关于测试方面书籍的总结笔记,一直放在我的个人U盘里,当时是用Xmind记录的,现在重新整理下分享给大家了! James A.Whittaker [美] 詹姆斯·惠特克(软件测 ...
- Page 63-64 Exercises 2.3.7 -------Introduction to Software Testing (Paul Ammann and Jeff Offutt)
Use the following method printPrimes() for question a-d below //Find and prints n prime integers pri ...
随机推荐
- centos 7 上安装 testlink 1.9.15/1.9.16/1.9.17/1.9.18 (mysql/php/httpd)
1.9.18 的System Requirements - server.注意,适用于 1.9.15 及以后. Server environment should consist of: web-se ...
- Mac 10.12安装网站圆形设计工具Axure RP Pro 7
下载: (链接: https://pan.baidu.com/s/1hsaTafi 密码: 855y)
- sql geography类型(地理坐标) 赋值
sql 语句赋值 update [lishui].[dbo].[t_NearbyService] ,, ) ,[locationbaidu]=geography::Point(,, ) where [ ...
- WCF系列教程之WCF中的会话
本文参考自http://www.cnblogs.com/wangweimutou/p/4516224.html,纯属读书笔记,加深记忆 一.WCF会话简介 1.在WCF应用程序中,回话将一组消息相互关 ...
- 机器学习 损失函数(Loss/Error Function)、代价函数(Cost Function)和目标函数(Objective function)
损失函数(Loss/Error Function): 计算单个训练集的误差,例如:欧氏距离,交叉熵,对比损失,合页损失 代价函数(Cost Function): 计算整个训练集所有损失之和的平均值 至 ...
- Datenstruktur und Algorithmus
In der Informatik und Softwaretechnik ist eine Datenstruktur ein Objekt zur Speicherung und Organisa ...
- JVM内存模型和垃圾回收
Java开发有个很基础的问题,虽然我们平时接触的不多,但是了解它却成为Java开发的必备基础——这就是JVM.在C++中我们需要手动申请内存然后释放内存,否则就会出现对象已经不再使用内存却仍被占用的情 ...
- Spring注解_详解
@Autowired 注释 将 @Autowired 注释标注在成员变量上 import org.springframework.beans.factory.annotation.Autowire ...
- 关于C# 委托(delegate)与事件(event)的用法及事例
C#中的委托和事件对于新手可能会有一点难理解,所以先从一个小例子入手,以便能更好的理解其如何使用.有一个学生每天定闹钟在早上6点起床,所以当每天早上6点的时候,闹钟就会响起来,从而学生才会按时起床. ...
- 配置/etc/profile错误导致很多系统命令无法使用
在配置hadoop的环境变量的过程中,由于字符输入错误导致/etc/profile文件出错,并导致系统的基本命令不能使用,如:vi,ls等. 这种情况,首先修改/etc/profile的错误文件内容, ...