亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-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
主站蜘蛛池模板: 秋霞影视伦理手机在线观看 | 久久久高清日本道免费观看 | 六月丁香激情综合成人 | 欧美中文字幕在线观看 | 性v天堂| 精品在线播放视频 | 中文字幕日韩专区 | 久青草中文字幕精品视频 | 国产18页 | 欧美日韩精品一区二区三区不卡 | 久操导航 | 国产一区二区三区欧美 | 欧美亚洲综合另类成人 | 国产成人精品s8p视频 | 99精品免费视频 | 亚洲精品视频在线免费 | 日本视频免费高清一本18 | 亚洲欧美日韩精品在线 | 日本一区二区三区中文字幕视频 | 欧美成人剧情中文字幕 | 国产在线高清视频 | 丁香五香天堂网 | 国产麻豆精品免费视频 | 国产 第1页 | 小明免费看视频 | 正品蓝导航永久福利在线视频 | 日本爽p大片免费观看 | 国产日韩欧美在线观看不卡 | 欧美一级成人免费大片 | 亚洲国产欧美精品 | 宅男色影院 | 亚洲自拍偷拍图 | 日本三级网站在线观看 | 伦理片中文 | 成人精品第一区二区三区 | 欧美激情欧美狂野欧美精品免费 | 亚洲首页成人有声小说网 | 国产日本亚洲欧美 | 密私密影院在线观看 | 97菊爱网 | 揉大乳gif动态图 |