当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

北京大学:《数据结构与算法》实习实验教程(PPT课件讲稿)实践之四:浅谈软件测试

资源类别:文库,文档格式:PPT,文档页数:62,文件大小:1.68MB,团购合买
点击下载完整版文档(PPT)

数据结构与算法实习 实践之四:浅谈软件测试 北京大学信息科学技术学院 张铭、郝丹 2011年8月

+ 数据结构与算法实习 ——实践之四:浅谈软件测试 北京大学信息科学技术学院 张 铭、郝 丹 2011年8月

判断三角形形状 Input: a, b 0 utput:三角形的形状? 等边三角形? 等腰三角形? 一般三角形?

+ 判断三角形形状 ▪ Input: a, b, c ▪ Output: 三角形的形状? ▪ 等边三角形? ▪ 等腰三角形? ▪ 一般三角形? ▪ …?

Java程序 import java. util class hu i int a, b, C; void judged I Scanner in=new Scanner(System. in) System. out. println(“ Please enter a,b,c:”) a=in. nextlnto; b=in. nextlnto; c=in nextinto if(a<o b<olIc<0)System. out. println("Error input! ); else if(a+b<=c b+c<=aa+c<=b) System. out printin(not a triangle!") else if(a==b & b==c & a==c) System. out printIn(equilateral triangle! ); else if(a==b l b==c a==c)System. out printIn( isosceles triangle) else System. out. printIn(only a triangle!): public class triangle public static void main(string l args)t Hu che =new Hu(; che. judge:]

+Java程序 import java.util.*; class Hu { int a,b,c; void judge() { Scanner in=new Scanner(System.in); System.out.println(“Please enter a,b,c:”); a=in.nextInt();b=in.nextInt();c=in.nextInt(); if(a<0||b<0||c<0) System.out.println(“Error input!”); else if(a+b<=c || b+c<=a || a+c<=b) System.out.println(“not a triangle!”); else if(a==b && b==c && a==c) System.out.println(“equilateral triangle!”); else if(a==b || b==c || a==c) System.out.println(“isosceles triangle!”); else System.out.println(“only a triangle!”);} } public class triangle{ public static void main(String[] args) { Hu che =new Hu(); che.judge();} } a b c

+测试 mport ja int a, b, c; void judge Scanner inane a=3,b=4,c=5 Scanner(System. in) System. out println(" Please enter a, b, c:) a=in. nextinto; b=in. nextlnto; c=in nextlnto: if(a< b<olIc<o) a=4,b=4,c=5 System. out. printin("Error input! ) else if(a+b<=c‖b+c≤=a‖l a+c≤=b) System. out. printin(“not else if(a==b & b=c && a==c) a=4,b=4,c=4 ystem out printin(equilateral riangle! ") else if(a=b‖b==c‖a==c) System. out println(isosceles triangle!"); else System. out printin("only a triangle!):1 a=2,b=4,c=5 public class triangle public static void main(stringl rgs)( Hu che =new HuO he judge 0:]

+测试 import java.util.*; class Hu { int a,b,c; void judge() { Scanner in=new Scanner(System.in); System.out.println( “Please enter a,b,c:”); a=in.nextInt();b=in.nextInt();c=in .nextInt(); if(a<0||b<0||c<0) System.out.println( “Error input!”); else if(a+b<=c || b+c<=a || a+c<=b) System.out.println( “not a triangle! ” ) ; else if(a==b && b==c && a==c) System.out.println( “equilateral triangle! ”); else if(a==b || b==c || a==c) System.out.println( “isosceles triangle!”); else System.out.println( “only a triangle! ”);} } public class triangle{ public static void main(String[] args) { Hu che =new Hu(); che.judge();} } a c b a=3, b=4, c=5 a=4, b=4, c=5 a=4, b=4, c=4 a=2, b=4, c=5 …

软件故障引起的灾难2万旅客滞 洛杉矶国际机场 中 0人 辐射治疗仪 Therac/ 导致6起医疗事故 1986 1988 2000 2007

+ 软件故障引起的灾难 1986 辐射治疗仪Therac 25 导致6起医疗事故 1988 空中客车320导致 290人死亡 2000 2007 2万旅客滞留 洛杉矶国际机场

进一步的思考 我们不能期望程序总是正确运行! 精心开发的程序 5 faults/1000 Loc 5000 faults/1M LOc Windows xP: 45M LOC 45×5000=225,000 faults

+ 进一步的思考 ▪我们不能期望程序总是正确运行! ▪精心开发的程序 ▪ 5 faults/1000 LOC ▪ 5000 faults/1M LOC ▪ Windows XP: 45M LOC ▪ 45 × 5000=225,000 faults

进一步的思考 如何发现错误? 测试!

+ 进一步的思考 ▪我们不能期望程序总是正确运行! ▪精心开发的程序 ▪ 5 faults/1000 LOC ▪ 5000 faults/1M LOC ▪ Windows XP: 45M LOC ▪ 45 × 5000=225,000 faults 如何发现错误? 测试!

什么是软件测试? Software Testing is the process of executing a program or system with the intent of finding errors 3)5 The Art of Software Testing by G. Myers

+ 什么是软件测试? ◼“Software Testing is the process of executing a program or system with the intent of finding errors. ” ---“The Art of Software Testing” ◼ by G.J.Myers

Software to be tested

+ Software to be tested

Test case generation est case Software to be tested verification Output

+ Software to be tested Output Test Case verification Test case generation

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共62页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有