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 ...
随机推荐
- python3.6.4没有raw_input
之前是一直在用Python2.7版本,2.7里面raw_input()和input个人认为区别在于raw_input()可以输入字符串和中文,而input()只接受数字,输入字符串就会报错. 现在用的 ...
- Mac 10.12安装Atom文本增强编辑工具
下载: https://atom.io/
- (转)Oracle与DB2在数据库高可用技术上的相同与差异探讨
原文:http://www.talkwithtrend.com/Article/178339 数据库建设过程中,高可用是每一个企业数据中心数据库建设过程中至关重要的一个关注点,直接关系到业务连续性和稳 ...
- 如何修改 linux ubuntu 默认语言
最近学习linux中,由于安装时选择了简体中文作为默认语言,时常出现乱码现象,所以决定将默认语言改回en_US. 但是在网上找了一些教程,发觉不一定都能实现.现总结如下: (1)对于大部分linux系 ...
- linux下wc功能的简单实现
1.代码来源:自己编写 2.运行环境:linux终端 3.编程语言:c/c++语言 4.bug:未发现 5.当前功能:可以统计字符的字符数.行数.单词数 6.使用方法:wc -l 文件名-->统 ...
- linux 升级-杂
apt-cache search linux apt-cache search linux | grep generic apt-cache search linux | grep 4.10. apt ...
- -Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment avariable and mvn script match.
eclipse中使用maven插件的时候,运行run as maven build的时候报错 -Dmaven.multiModuleProjectDirectory system propery is ...
- Softwaretechnik
1.Einführung 1.1 Was ist Softwareentwicklung Softwareentwicklung ist eine Wissenschaftliches Fach üb ...
- Nginx 基于客户端 IP 来开启/关闭认证
前些日子帮助公司在搭建了一个内部资源的导航页面,方便公司员工访问各种常用的系统.因为这个页面包含一些敏感信息,我们希望对其做认证,但仅当从外网访问的时候才开启,当从公司内网访问的时候,则无需输入账号密 ...
- 八: 操作提示(wxml 即将废弃)
首先需要注意的是 wxml的这些属性将要被废弃,不过可以看两眼.不愿意看的可以看下一章节同样是操作回馈只不过是js版的哦. 一.action-sheet 操作菜单 从屏幕底下出来菜单. 这里不用w ...