软件测试与交付课程笔记1
1.导论
1. 为何需要软件测试?
直接写出完美的软件是不可能的。测试已经成为业界在开发过程中评估软件的基础方法(primary way)。
2. 什么是软件测试?(The goal of ST)
- 确保程序/系统做它该做的事
- 找错
3.测试的经济性
有效的测试(effective testing) ,关注测试用例的设计
测试用例的内容:
- Test case identifier(usually a short name for test management purposes)
- Name
- Purpose
- Pre-conditions(if any)
- Inputs
- Expected outputs
- Observed outputs
- Pass/fail?
一个例子,三个整数,判断是等边、等腰或者不规则三角形:
有效等价类:
- 一个不规则三角形(5,6,7)
- 一个等腰三角形(3,3,4; 3,4,3; 4,3,3 三种排列都要测试)
- 一个等边三角形
无效等价类:
- 一边为0
- 一边为负值
- 三个大于0的整数,且两边之和等于第三边(根据ppt这个也要三种排列 e.g. 1,2,3; 1,3,2; 3,1,2)
- 三个大于0的整数,且两边之和小于第三边(根据ppt这个也要三种排列 e.g. 1,2,4; 1,4,2; 4,1,2)
- 所有边都为0?
- 至少一边小数?
- 只输入两个数或者多输入数
4. 软件测试原则
7条原则:
-
测试显示出bug
-
穷举测试是不可能的(有效的测试很重要)
-
早点开始测试
-
错误/缺陷常常扎堆出现(Defect clustering)
-
杀虫剂悖论(The pesticide paradox) 找到的错越多越难找
-
测试是依赖上下文的(Testing is context dependent)
-
Absence of errors fallacy
其他一些测试原则:
- 测试应该由独立第三方来做
- 有效的、无效的,期望的、不期望的输入都要测
- Keep software static during test
- 可以的话提供期望的测试结果
- 测试不是系统生命周期(SDLC)的一个单独阶段
- 测试要从小组件开始,扩展到整个程序
- 软件测试中做好记录(everything)
- 测试员需要参见规格和设计审查(specification and design review)
5. 一些术语
Validation & Verification
Validation
The process of evaluating software at the end of software development to ensure compliance(合规) with intended usage. (Are we doing the right job?)
Not done by developers, but by experts in the intended usage of the software
Verification(验收)
(Are we doing the job right?)
确定软件开发某一阶段的产品是否满足了之前确定的要求。需要科技背景,通常由不同极端的开发者来做。
IV&V 代表 “independent verification and validation”
Faults, Errors & Failures
以医生为病人做诊断为例,failure是症状,fault是根本原因,Error是fault的一种显现。
Fault: 源代码的错误,static defect
Error : 源代码运行之后,Fault就会导致Error。An incorrect internal(内部) state that is the manifestation(显示、表明) of some fault.
Failure:与需求或其他期望行为的描述有关的外部的、不正确的行为。
e.g. 错误状态向程序输出的传播;一个错误导致整个系统与其要求的操作偏离。
测试是找failure,Debugging是给faliure找fault
6. RIRP model and TC generation
一个failure被观察到的四个必要条件(RIPR):
Reachability:包含fault的位置能够达到
Infection: fault的执行能导致Error
Propagation:得能导致输出或最终状态不正确(failure)
Revealability: 测试者观察程序状态的错误部分(对测试员的要求)
TC generation

1:没有实现的需求规格中的部分
4: 多实现的部分
2:没有正确实现的部分
4:正确实现的部分

Specification-based testing
-
Functional testing
-
Black box testing

Code-based testing
-
Structural testing
-
White box testing
-
Clear box testing

功能测试(Functional Testing)vs 结构化测试(Structural Testing)
功能测试很难发现没有具体说明的行为(额外部分的fault)
结构测试很难发现没有实现的行为(忽略部分的fault)
结论:两种测试都需要

浙公网安备 33010602011771号