本书回顾了软件产业的发展历程,进而引出接下来要讲述的本书主要内容——软件测试的基础知识、原理以及相关技术。然后,在阐述静态和动态软件测试原理之前给出了一些关键定义等。
Prefaceii
1 Introdu*ion1
1.1 The Software Industry1
1.1.1 Software Testing and Quality2
1.1.2 Software Testing and Risk Management3
1.2 Mistakes, Faults and Failures3
1.2.1 Software Faults4
1.2.2 Software Failures5
1.2.3 Need for Testing6
1.3 The Role of Specific*ions8
1.4 Overview of Testing9
1.4.1 Testing in the Development Process9
1.4.2 Test Auto*tion9
1.5 The Theory of Testing10
1.5.1 Exhaustive Testing Example11
1.5.2 Implic*ions11
1.5.3 When To Finish Testing12
1.6 Book Stru*ure13
1.6.1 Order of Testing14
1.6.2 Programming Language14
1.6.3 Level of Detail14
1.6.4 Code Examples14
1.7 Notes on Terminology14
2 Principles of Software Testing15
2.1 St*ic Verific*ion15
2.1.1 Walk-throughs16
2.1.2 Code Reviews/Inspe*ions16
2.1.3 For*l Methods and Testing18
2.2 Dynamic Verific*ion19
2.3 Black-Box and White-Box Testing19
2.3.1 Erro* of “Omission” and “Commission” 21
2.4 Test Approaches22
2.4.1 Black-Box Testing22
2.4.2 White-Box Testing23
2.4.3 Fault Insertion24
2.5 Test Design Process24
2.5.1Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.5.2Gener*ing Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.5.3Gener*ing Test D*a . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.5.4Implementing Tests . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6 Analysis of Software Specific*ions . . . . . . . . . . . . . . . . . . . . . . 27
2.6.1Paramete* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6.2Parameter Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6.3Equivalence Partitions . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.6.4Boundary Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.5Combin*ions of Values . . . . . . . . . . . . . . . . . . . . . . . . 30
2.6.6Sequences of Values . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.7 Analysis of Software Components . . . . . . . . . . . . . . . . . . . . . . 40
2.7.1Control Flow Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.7.2Decisions and Conditions . . . . . . . . . . . . . . . . . . . . . . . 43
2.7.3P*hs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.7.4D*a Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.8 Analysis of Targets for Fault Insertion . . . . . . . . . . . . . . . . . . . . 47
2.8.1Offutt’s 5 Sufficient Mut*ions . . . . . . . . . . . . . . . . . . . . 47
2.9 TestArtefa*s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3 Unit Testing50
3.1 Techniques50
3.2 Usage51
3.3 Black-Box Techniques52
3.3.1 Equivalence Partitioning (EP)52
3.3.2 Boundary Value Analysis (BVA)53
3.3.3 Testing Combin*ions of Inputs55
3.3.4 Testing Sequences of Inputs/St*e-Based Testing56
3.3.5 Testing with Random D*a . . . . . . . . . . . . . . . . . . . . . . 56
3.3.6 Error Guessing/Expert Opinion . . . . . . . . . . . . . . . . . . . . 58
3.4White-Box Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.4.1St*ement Coverage (SC) . . . . . . . . . . . . . . . . . . . . . . . 60
3.4.2 Branch Coverage (BC) . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.4.3 Condition Coverage (CC) . . . . . . . . . . . . . . . . . . . . . . 62
3.4.4 Decision Condition Coverage (DCC) . . . . . . . . . . . . . . . . . 64
3.4.5 Multiple Condition Coverage (MCC) . . . . . . . . . . . . . . . . .65
3.4.6 Modified Condition Decision Coverage (MCDC) . . . . . . . . . .66
3.4.7 P*h Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.4.8 D*aflow Coverage (DU Pai*) . . . . . . . . . . . . . . . . . . . . 68
3.5 Fault Insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.5.1 Strong Mut*ion Testing . . . . . . . . . . . . . . . . . . . . . . . . 69
3.6Test Ranking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4 Unit Testing Examples 71
4.1Example One: fits . .