注册 登录 进入教材巡展
#
  • #

出版时间:2019-04-26

出版社:机械工业出版社

以下为《软件测试:原理与实践(英文版)(第2版)》的配套数字资源,这些资源在您购买图书后将免费附送给您:
  • 机械工业出版社
  • 9787111624066
  • 1-5
  • 47229564-1
  • 16开
  • 2019-04-26
  • 411
  • 计算机通信类
  • 本科
内容简介
本书的内容基于爱尔兰国立大学梅努斯和浙江大学的一系列课程讲稿。该书覆盖了软件测试的基本原理和主要方法,可以作为软件测试全英课程或双语课程的教材。
目录
Prefaceii
1 Introduction1
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 Specifications8
1.4 Overview of Testing9
1.4.1 Testing in the Development Process9
1.4.2 Test Automation9
1.5 The Theory of Testing10
1.5.1 Exhaustive Testing Example11
1.5.2 Implications11
1.5.3 When To Finish Testing12
1.6 Book Structure13
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 Static Verification15
2.1.1 Walk-throughs16
2.1.2 Code Reviews/Inspections16
2.1.3 Formal Methods and Testing18
2.2 Dynamic Verification19
2.3 Black-Box and White-Box Testing19
2.3.1 Errors 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.2Generating Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.5.3Generating Test Data . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.5.4Implementing Tests . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6 Analysis of Software Specifications . . . . . . . . . . . . . . . . . . . . . . 27
2.6.1Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6.2Parameter Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6.3Equivalence Partitions . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.6.4Boundary Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.5Combinations 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.3Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.7.4Data Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.8 Analysis of Targets for Fault Insertion . . . . . . . . . . . . . . . . . . . . 47
2.8.1Offutt’s 5 Sufficient Mutations . . . . . . . . . . . . . . . . . . . . 47
2.9 TestArtefacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Combinations of Inputs55
3.3.4 Testing Sequences of Inputs/State-Based Testing56
3.3.5 Testing with Random Data . . . . . . . . . . . . . . . . . . . . . . 56
3.3.6 Error Guessing/Expert Opinion . . . . . . . . . . . . . . . . . . . . 58
3.4White-Box Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.4.1Statement 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 Path Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.4.8 Dataflow Coverage (DU Pairs) . . . . . . . . . . . . . . . . . . . . 68
3.5 Fault Insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.5.1 Strong Mutation Testing . . . . . . . . . . . . . . . . . . . . . . . . 69
3.6Test Ranking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4 Unit Testing Examples 71
4.1Example One: fits() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.1.1Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.1.2Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.1.3Note on Black-Box Testing . . . . . . . . . . . . . . . . . . . . . . 72
4.1.4Equivalence Partitioning . . . . . . . . . . . . . . . . . . . . . . . . 72
4.1.5Boundary Value Analysis . . . . . . . . . . . . . . . . . . . . . . . 77
4.1.6 Combinational Testing . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.1.7 Random Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.1.8 Testing Sequences of Inputs . . . . . . . . . . . . . . . . . . . . . . 82
4.1.9 Elimination of Duplicate Black-Box Tests . . . . . . . . . . . . . .82
4.1.10 Important Note on White-Box Testing . . . . . . . . . . . . . . . .83
4.1.11 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.1.12 Statement Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.1.13 Branch Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.1.14 Condition Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.1.15 Decision/Condition Coverage . . . . . . . . . . . . . . . . . . . . . 88
4.1.16 Multiple Condition Coverage . . . . . . . . . . . . . . . . . . . . . 90
4.1.17 Modified Condition Decision Coverage . . . . . . . . . . . . . . . .90
4.1.18 Path Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.1.19 Dataflow Coverage (DU Pairs) . . . . . . . . . . . . . . . . . . . . 93
4.1.20 Elimination of Duplicate Tests . . . . . . . . . . . . . . . . . . . . 95
4.1.21 Test Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.2 Example Two: premium()97
4.2.1 Description97
4.2.2 Specification97
4.2.3 Equivalence Partitioning97
4.2.4 Boundary Value Analysis101
4.2.5 Combinational Testing . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.2.6 Random Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.2.7 Elimination of Duplicate Black-Box Tests . . . . . . . . . . . . . .105
4.2.8 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.2.9 Statement Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.2.10 Branch Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.2.11 Condition Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.2.12 Decision/Condition Coverage . . . . . . . . . . . . . . . . . . . . . 111
4.2.13 Multiple Condition Coverage . . . . . . . . . . . . . . . . . . . . . 113
4.2.14 Modified Condition Decision Coverage . . . . . . . . . . . . . . . .116
4.2.15 Path Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.2.16 Dataflow Coverage (DU Pairs) . . . . . . . . . . . . . . . . . . . . 119
4.2.17 Elimination of Duplicate Tests . . . . . . . . . . . . . . . . . . . . 121
4.2.18 Test Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5 Unit Testing Object-Oriented Software123
5.1 Characteristics of Object-Oriented Software124
5.2 Effects of OO on Testing124
5.3 Object-Oriented Testing Models125
5.3.1 Conventional Models125
5.3.2 Combinational Models126
5.3.3 State Machine Models127
5.3.4 Specification & Design Models129
5.3.5 Built-In-Test130
5.4 Example 1131
5.4.1 Class CarTax131
5.4.2 Black-Box Testing in Class Context131
5.4.3 Equivalence Partitioning132
5.4.4 Boundary Value Analysis134
5.4.5 Combinational Testing134
5.4.6 White-Box Testing in Class Context134
5.4.7 Combinational Testing at the Class Level135
5.4.8 State-Machine Testing137
5.4.9 Specification/Design Testing141
5.4.10 Built-In Testing141
5.5 Example 2143
5.5.1 Classes Shape and Square143
5.5.2 Specification/Design Testing143
6 Integration Testing145
6.1 Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.1.1Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.1.2Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
6.1.3Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
6.1.4Test Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 147
6.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
6.2.1The Premium System . . . . . . . . . . . . . . . . . . . . . . . . . 148
6.2.2Sequence Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
6.2.3Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.2.4Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.2.5Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.2.6Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.2.7Test Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 153
6.2.8Interpretation of Test Results . . . . . . . . . . . . . . . . . . . . . 153
6.3External Integration Testing . . . . . . . . . . . . . . . . . . . . . . . . . 153
6.4 Unit Testing during Software Integration154
6.4.1 Drivers and Stubs154
6.4.2 Top-Down Integration154
6.4.3 Bottom-Up Integration155
6.4.4 Incremental Feature/Continuous Integration155
7 System Testing156
7.1 Introduction156
7.1.1 System Test Categories156
7.2 Usage158
7.2.1 System Level Functional Testing158
7.2.2 Test Cases160
7.3 GUI Testing Example160
7.3.1 Example System161
7.3.2 Testing the Interface Behaviour167
7.3.3 Testing the Interface Navigation168
7.3.4 Testing Software Features170
7.3.5 Testing Use Cases and Scenarios173
7.3.6 Testing a Web-Based GUI174
7.4 Field Testing and Acceptance Testing175
7.4.1 Field Testing175
7.4.2 Acceptance Testing175
8 Software Test Automation176
8.1 Unit Test Automation177
8.1.1 TestNG177
8.1.2 Basic TestNG Features177
8.1.3 Other TestNG features179
8.1.4 Documenting Automated Tests181
8.1.5 Automated Unit Testing in an IDE182
8.2 Automated Unit Test Example: fits()182
8.2.1 Testing fits() with Inline Data182
8.2.2 Parameterised Tests for fits()183
8.3 Coverage Measurement Automation186
8.3.1 EclEmma Example186
8.3.2 Lazy Evaluation187
8.4 Automated Object-Oriented Unit Testing188
8.4.1 CarTax Example188
8.4.2 Automating Inheritance Testing188
8.5 Automated System Testing190
8.5.1 Swing-Based GUI Example191
8.5.2 Web-Based GUI Example197
8.6 Selenium IDE (Integrated Development Environment) . . . . . . . . . . .205
8.7 Other Test Automation Tools and Techniques . . . . . . . . . . . . . . . .205
8.7.1 Customising the Test Runner205
8.7.2 Stress Testing206
8.7.3 Mutation Testing207
9 Testing in the Software Process209
9.1 Test Planning210
9.2 Software Development Life Cycle211
9.3 The Waterfall Model211
9.4 The V-Model .212
9.5 Incremental and Agile Development213
9.5.1 Incremental Development214
9.5.2 Extreme Programming215
9.5.3 SCRUM217
9.5.4 DevOps218
9.5.5 Process-Related Quality Standards and Models219
9.6 Repair-Based Testing219
9.6.1 Specific Repair Test219
9.6.2 Generic Repair Test219
9.6.3 Abstracted Repair Test220
9.6.4 Example220
9.6.5 Repair-Based Test Suites220
10 Advanced Testing Issues221
10.1 Philosophy of Testing221
10.2 Test Technique Selection222
10.3 Design For Testability (DFT)222
10.4 Overlapping and Discontinuous Partitions223
10.4.1 Overlapping Input Partitions223
10.4.2 Overlapping Output Partitions223
10.4.3 Inband Error Reporting224
10.5 Handling Relative Values225
10.5.1 Classic Triangle Problem226
10.6 Pairwise Testing227
10.7 Modified Combinational Testing228
10.8 Improved Condition Coverage229
10.9 Testing with Floating Point Numbers229
10.10 Testing with Complex Data Structures231
10.11 State-Based or Sequential Testing231
10.12 Inserting Data Faults235
10.13 Automated Statement and Branch Testing235
10.14 Automated Random Testing235
10.15 OO Dataflow Testing (DU Pairs)237
10.16 Verifying State in Object-Oriented Testing239
10.17 Advanced OO Testing240
10.17.1 Multiplicity in UML Class Diagrams241
10.18 Text-Based Value Representation242
10.19 Unit Testing of GUI Components243
10.20 Some issues in Testing Web-Based Applications244
10.21 Responsive UI Design Testing244
10.22 Testing Concurrent and Parallel Software244
10.22.1 Unit Testing245
10.22.2 System Testing245
10.22.3 Static Analysis245
10.22.4 Tools245
10.23 Testing Embedded Software246
10.24 Testing Network Protocol Processing248
10.24.1 Text-Based Protocols248
10.24.2 Binary Protocols249
10.24.3 Protocol Stacks and DFT249
10.25 Including Testing In The Build Procedure249
10.26 Research Directions250
APPENDICES
A Terminology 252
B Software Testing Tools 254
C Exercises 255
C.1 TestNG and Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
C.2 Unit Test - Exercise 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
C.3 Unit Test - Exercise 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
C.4 Unit Test - Exercise 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
C.5 Unit Test - Exercise 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
C.6 Unit Test - Exercise 5260
C.7 Unit Test - Exercise 6261
C.8 Unit Test - Exercise 7262
C.9 Unit Test - Exercise 8262
C.10 Unit Test - Exercise 9263
C.11 Exercise 10 - Test Projects264
D Source Code265
D.1 Chapter 4 - Unit Testing Examples265
D.1.1 CharterFlight.java265
D.1.2 CharterFlightTest.java266
D.1.3 Insurance.java267
D.1.4 InsuranceTest.java268
D.2 Chapter 5 - OO Testing269
D.2.1 CarTax.java269
D.2.2 CarTaxTest.java270
D.2.3 CarTaxWithAssertions.java271
D.2.4 CarTaxWithAssertionsTest.java273
D.2.5 Shape.java273
D.2.6 Square.java274
D.2.7 ShapeTest.java274
D.2.8 SquareTest.java274
D.3 Chapter 6 - Integration Testing275
D.3.1 PremiumCalculator.java275
D.3.2 Validator.java276
D.3.3 PremiumCalculatorIntegrationTest.java276
D.4 Chapter 7 - System Testing277
D.4.1 FlightBooker.java277
D.4.2 SimpleSwingTestFramework.java279
D.4.3 FlightBookerBehaviourTest.java282
D.4.4 FlightBookerNavTest.java283
D.4.5 FlightBookerFeatureTest.java285
D.4.6 FlightBookerScenarioTest.java286
D.4.7 FlightBookerWebTest.java288
D.5 Chapter 8 - Software Test Automation292
D.5.1 Demo.java292
D.5.2 DemoTest.java293
D.5.3 DemoTestM.java293
D.5.4 DemoTestA.java294
D.5.5 DemoTestB.java294
D.5.6 Demo2.java295
D.5.7 Demo2Test.java295
D.5.8 testng-1.xml295
D.5.9 CharterFlightTestInline.java296
D.5.10 CustomRunner.java296
D.6 Chapter 10 - Advanced Issues298
D.6.1 Lamp1.java298
D.6.2 Lamp2.java298
D.6.3 Lamp1Test.java298
D.6.4 Lamp2Test.java299
Select Bibliography300