软件可测试性的启发
陈能技
2007-8-10
原文:
Heuristics of Software Testability James Bach, Satisfice, Inc.
The better we can control it, the more the testing can be automated and optimized.
我们越是能控制它,测试越能被自动化和优化
•
A scriptable interface or test harness is available.
存在可编程的接口或测试桩
•
Software and hardware states and variables can be controlled directly by the test engineer.
软件和硬件的状态、变量能被测试工程师直接控制
•
Software modules, objects, or functional layers can be tested independently.
软件模块、对象或功能层能被独立地测试
What you see is what can be tested.
你能看到的都是能被测试的
•
Past system states and variables are visible or queriable (e.g., transaction logs).
系统的过去状态和变量是可见的或可查询的(例如:事务日志)
•
Distinct output is generated for each input.
为每个输入产生独立的输出
•
System states and variables are visible or queriable during execution.
在执行过程中系统的状态和变量是可见的或可查询的
•
All factors affecting the output are visible.
所有影响输出的因素都是可见的
•
Incorrect output is easily identified.
不正确的输出能轻易被识别
•
Internal errors are automatically detected and reported through self-testing mechanisms.
内部错误通过自测机制被自动发现和报告
To test it, we have to get at it.
为了测试它,我们需要了解它
•
The system has few bugs (bugs add analysis and reporting overhead to the test process).
系统有很少
bug
(
bug
给测试过程增加分析和报告的成本)
•
No bugs block the execution of tests.
没有
bug
阻止测试的执行
•
Product evolves in functional stages (allows simultaneous development and testing).
产品在功能阶段进化(允许开发和测试同时进行)
•
Source code is accessible.
源代码可被访问
The simpler it is, the less there is to test.
越简单,需要的测试越少
•
The design is self-consistent.
设计是有条理的
•
Functional simplicity (e.g., the feature set is the minimum necessary to meet requirements)
功能简单(例如:功能特性集合是满足需求的最小集)
•
Structural simplicity (e.g., modules are cohesive and loosely coupled)
结构简单(例如:模块是松耦合的)
•
Code simplicity (e.g. the code is not so convoluded that an outside inspector can’t effectively review it)
代码简单(例如:代码不会费解到外部检查者不能有效地进行审查)
The fewer the changes, the fewer the disruptions to testing.
越少改变,对测试的影响越少
•
Changes to the software are infrequent.
对软件的更改很少发生
•
Changes to the software are controlled and communicated.
对软件的更改是被控制的和充分沟通的
•
Changes to the software do not invalidate automated tests.
对软件的更改不会造成自动测试的无效
The more information we have, the smarter we will test.
了解越多的信息,我们将测得更巧妙
•
The design is similar to other products we already know.
设计类似于其他我们已经知道的产品
•
The technology on which the product is based is well understood.
充分了解产品基于什么技术构造
•
Dependencies between internal, external and shared components are well understood.
充分了解内、外部和公共组件之间的依赖关系
•
The purpose of the software is well understood.
充分了解软件的用途
•
The users of the software are well understood.
充分了解软件的用户
•
The environment in which the software will be used is well understood.
充分了解软件的使用环境
•
Technical documentation is accessible, accurate, well organized, specific and detailed.
技术文档是可访问、准确、组织良好、明确和详细的
•
Software requirements are well understood.
充分了解软件需求