软件工程学:实现解读.pptx

通常把编码和测试统称为实现。 第7章 实 现 本章介绍编码和测试两个阶段,其中主要介绍进行单元测试、集成测试、确认测试的方法和步骤,设计测试方案的白盒和黑盒测试技术,以及软件可靠性的相关概念。 软件测试的任务:根据软件开发各阶段的文档资料和程序的内部结构,精心设计一组测试方案,用这些方案执行程序,找出软件中潜在的各种错误和缺陷,并进行调试纠错。 编码是详细设计的自然结果,是将详细设计得到的处理过程描述转换为基于某种程序设计语言的程序。 软件测试的目的:在软件投入生产运行之前,尽可能多地发现软件中的错误和缺陷。 防不胜防的软件错误 —— 例1:1963年, 美国, 飞往火星的火箭爆炸, 损失$ 10 million. 原因: FORTRAN循环 DO 5 I = 1, 3 误写为 DO 5 I = 1.3 例2:1996年,美国 Washington Post 报导 Dallas, Aug. 23 — The captain of an American Airlines jet that crashed in Colombia last December entered an incorrect one-letter computer command that sent the plane into a mountain, the airline said today. 第7章 实现 第7章 实现 The crash killed all but four of the 163 people aboard. American’s investigators concluded that the captain of the Boeing 757 apparently thought he had entered the coordinates for the intended destination, Cali. But on most South American aeronautical charts, the one-letter code for Cali is the same as the one for Bogota, 132 miles in the opposite direction. The coordinates for Bogota directed the plane toward the mountain, according to a letter by Cecil Ewell, American’s chief pilot and vice president for flight. The codes for Bogota and Cali are different in most computer databases, Ewell said. 软件测试是保证软件质量的关键步骤,是对软件规格说明、设计和编码的最后复审,其工作量约占总工作量40%以上(对于人命关天的系统,测试相当于其它开发总成本的3 - 5倍)。 这意味着,写出程序代码并不是开发工作接近完成,实际上还有大约同样多甚至更多的工作需要做。 第7章 实现 §1. 编码 2、编码风格 程序代码应简明清晰、易读易懂,应遵循以下规则: ? 程序内部应该有很好的文档(标示符、注释、组织等) ? 数据说明应该易于理解便于查阅(说明次序、实现方法等) ? 语句构造应该尽可能简单直观 ? 输入输出风格遵守人机界面设计准则 ? 效率满足用户需求即可(运行时间、存储效率、I/O效率等) §2. 软件测试基础 定义:测试是为了发现程序中的错误而执行程序的过程。 1、软件测试的目标 目标:证明程序有错误,从而发现错误并排除错误。 2、软件测试指导原则 ? 所有的测试都应该追溯到用户需求 ? 应该在测试开始之前制定严格的测试计划 ? 把Pareto原理应用到软件测试中 ? 应该从“小模块”开始,逐步过渡到“大模块”的测试 ? 不可能进行穷举测试 ? 测试方案应作为文档长期保存 ? 应该由独立的第三方进行测试 3、软件测试方法与技术 §2. 软件测试基础 (1)静态测试与动态测试 静态测试是指被测试程序不在机器上运行,而是采用人工测试或计算机辅助分析的手段对程序进行的测试。 动态测试是指通过实际运行被测试程序从而发现错误的测试。 (2)黑盒测试与白盒测试 黑盒测试(black-box , or closed-box

文档评论(0)

1亿VIP精品文档

相关文档