亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源單元測試工具 > junit
Junit與Eclemma的安裝及應用
作者:夢碎 發布時間:[ 2017/4/6 15:40:55 ] 推薦標簽:單元測試 Junit

  一、junit和hamcrest安裝及引入
  1.輸入網址http://junit.org/junit4/下載junit及hamcrest
  2.打開Eclipse新建一個project
  3.右鍵點擊build path 引進junit

  二、eclemma安裝
  點擊help-->Eclipse Marketplace-->在find中輸入eclemma-->install-->重啟Eclipse
  三、三角形問題及junit、hamcrest、eclemma的使用
  1、編寫三角形判斷程序
public class triangle_problem {
String triangle_juidje(double a,double b, double c){
if(a == b && a == c){
String str = new String();
str = "the trangle is equilateral";
return str;
}
if((a+b)>c &&(a+c)>b &&(b+c)>a){
if((a == b && a != c)|| (a==c && a != b) || (b == c && b != a)){
String str = new String();
str = "the trangle is isosceles";
return str;
}
if(a!=b && b!=c){
String str = new String();
str = "the trangle is scalene";
return str;
}
}
else{
String str = new String();
str = "the three edges can't make up a trangle!";
return str;
}
return null;
}
}
  2、junit類生成
  選中類-->new-->jUnit Test Case

  3、編輯junit內容
import static org.junit.Assert.*;
import org.junit.Test;
public class triangle_problemTest {
private triangle_problem tri;
@Test
public void testequilateral() {
tri = new triangle_problem();
assertEquals("the trangle is equilateral",tri.triangle_juidje(3,3,3));
}
@Test
public void testisosceles() {
tri = new triangle_problem();
assertEquals("the trangle is isosceles",tri.triangle_juidje(2,3,2));
}
@Test
public void testscalene() {
tri = new triangle_problem();
assertEquals("the trangle is scalene",tri.triangle_juidje(2,3,4));
}
@Test
public void testnottrangle() {
tri = new triangle_problem();
assertEquals("the three edges can't make up a trangle!",tri.triangle_juidje(2,3,5));
}
}
  4、運行junit文件

  5、運行eclemma

軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 台湾一级毛片 | 欧美亚洲激情 | 日本乱仑 | www.男插女b免费视频 | www在线| 在线视频 一区二区 | 亚洲丶国产丶欧美一区二区三区 | 中文字幕日韩精品在线 | 日韩精品国产自在久久现线拍 | 国产欧美视频在线观看 | 亚洲国产成人久久 | 一级特黄高清完整大片 | 在线观看国产一区亚洲bd | 我色综合 | 在线欧美视频免费观看国产 | www.黄在线| 日韩一区二区三区在线观看 | 人人舔人人插 | 日韩国产在线观看 | 97精品国产自在现线免费观看 | 日韩最新中文字幕 | 亚洲大成色www永久网址 | 亚洲国产成人久久一区www妖精 | 一区二区不卡免费视频 | 色先锋资源网 | 国产成人精品s8p视频 | 亚洲三级天堂 | 区二区三区四区免费视频 | 国产日本欧美在线观看乱码 | 99看视频| 免费一级国产大片 | 亚洲午夜免费视频 | 久久精品国产2020 | 热久久视久久精品18国产 | 免费视频18 | 久久夜色精品国产亚洲 | 狠狠插综合网 | 亚洲欧美日韩一区高清中文字幕 | 国产欧美日韩精品a在线观看 | 一级毛片中国 | 色噜噜狠狠色综合日日 |