测试有道:微软测试技术心得
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

什么是软件测试

要点

多年来,许多专家已提出各种不同的关于软件测试(Software Testing)的定义,其中一些关于测试的共同定义包括:

“……以寻找错误为目的的执行程序的过程。”

——迈尔斯G. J. 软件测试的艺术,Wiley出版社,1979年

“软件测试是一个以寻找错误为目的的分析和操作软件的过程。”

——克里斯·布朗,格雷·柯布,罗伯特·卡伯特森,软件测试快速入门,2001年

该领域的很多专家似乎都在倡导测试的主要目的是找到缺陷,而且尽可能在软件开发生命周期的早期发现这些缺陷。但是,上面这些被过分简单化的对软件测试的解释却存在着两个基本问题。

(1)尽可能多地去发现缺陷会使测试成为一种数字游戏。难道找到一大堆漏洞就意味着测试人员的工作做得很好?难道寻找到的缺陷越多就越能提高软件质量?这种测试行为是“有质量的测试”吗?

(2)当测试工程师把工作的重点放在寻找更多的错误上的时候,他们往往会急功近利,忽略一些偏僻的问题,或者会把一些情况视为理所当然。

心得

归根结底,软件测试的目的是为了保证软件产品的最终质量。所以,软件测试要做到:(1)要证明软件是“工作的”; (2)要证明软件是“不工作的”; (3)要证明存在软件缺陷;(4)不能以“寻找错误”为目标;(5)不要试图穷尽测试;(6)要测试“软件规格说明书”; (7)要深入分析缺陷和错误;(8)要帮助度量软件质量并为团队中的其他成员(如项目经理、软件开发工程师)提供信息。

Software testing is…

Over the years many experts have proposed various definitions for software testing, some common definitions of testing including:

… The process of executing a program with the intent of finding errors, (Myers, G. J., the art of software testing, Wiley, 1979)

“Execute a program or system with the intention of finding errors.”-Myers, 1979

Software testing is a process of analyzing or operating software for the purpose of finding bugs. (Chris Brown, Gray Cobb, Robert Culbertson, Introduction to Rapid Software Testing, 2001)

May experts in the field seem to advocate the primary purpose of testing is to find defects; as many as possible as early in the software development lifecycle as possible. Unfortunately there are 2 fundamental problems with this simplistic interpretation of software testing.

Finding as many as defects as we can as early as possible can make testing a numbers game. Does a large bug count imply testing is doing a good job? High numbers of bugs don' t always mean the testing effort is finding the most important critical issues as early as possible. Another potential side effect of simply finding as many as bugs as possible includes artificial explosion of bug count. Defects manifest themselves in many ways; if a tester doesn' t take time to investigate or understand the cause of a bug then they could write several bug reports for a single issue. Unfortunately, novice testers often believe that by finding as many as defects as they can they are improving software quality. YOU CANNOT TEST IN QUALITY.

When the test engineer is focused on finding more bugs they tend to skip over areas or take things for granted. Antidotal evidence suggests that testers often miss simple errors because they are too focused on finding as many as bugs as possible or finding the most heinous bugs. For example, testing boundary conditions some testers may exercise the specific valid boundary values and then try invalid values well above or below the valid boundary values instead of minimum -1 and maximum +1. Also, many testers simply overlook the minimum +1 value and the maximum -1 value assuming if the minimum and maximum value worked so everything in between the range of minimum and max is the valid equivalence class. This oversight can lead to missed errors in arrays or in assignments for ranges of data.