View
226
Download
0
Category
Preview:
Citation preview
Software EngineeringSoftware Engineering
Chapter 23 Chapter 23 Software TestingSoftware Testing
Ku-Yaw ChangKu-Yaw Changcanseco@mail.dyu.edu.twcanseco@mail.dyu.edu.tw
Assistant ProfessorAssistant ProfessorDepartment of Computer Science and Information EngineeringDepartment of Computer Science and Information Engineering
Da-Yeh UniversityDa-Yeh University
22Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
ObjectivesObjectives
Understand the distinctions between validation Understand the distinctions between validation testing and defect testing;testing and defect testing;
Understand the principles of system testing and Understand the principles of system testing and component testing;component testing;
Understand three strategies that may be used to Understand three strategies that may be used to generate system test cases;generate system test cases;
Understand the essential characteristics of Understand the essential characteristics of software tools that support test automationsoftware tools that support test automation
33Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
PreamblePreamble
Two distinct goalsTwo distinct goals To demonstrate to the developer and the customer To demonstrate to the developer and the customer
that the software that the software meets its requirementsmeets its requirements..Validation testValidation test
To discover faults or defectsTo discover faults or defects in the software where the in the software where the behavior of the software is incorrect, undesirable or behavior of the software is incorrect, undesirable or does not conform to its specification.does not conform to its specification.
Defect testingDefect testing
Testing can only show the presence of errors, Testing can only show the presence of errors, not their absencenot their absence
– Edsger Dijkstra – Edsger Dijkstra
44Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
PreamblePreamble
An abstract view of software testingAn abstract view of software testing Component testingComponent testing
Testing the parts of the systemTesting the parts of the system System testingSystem testing
Testing the system as a wholeTesting the system as a whole
Componenttesting
Systemtesting
Software developer Independent testing team
55Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
A Model ofA Model ofthe Software Testing Processingthe Software Testing Processing
Design testcases
Prepare testdata
Run programwith test data
Compare resultsto test cases
Testcases
Testdata
Testresults
Testreports
66Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
PreamblePreamble
Exhaustive testing is impossibleExhaustive testing is impossible Every possible program execution sequence Every possible program execution sequence
is testedis tested
77Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
ContentsContents
23.1 System testing23.1 System testing
23.2 Component testing23.2 Component testing
23.3 Test case design23.3 Test case design
23.4 Test automation23.4 Test automation
88Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
System TestingSystem Testing
Integrate two or more componentsIntegrate two or more components Testing this integrated systemTesting this integrated system
Two distinct phasesTwo distinct phases Integration testingIntegration testing
Access to the source codeAccess to the source codeFind the source of the problemFind the source of the problem
Identify the componentsIdentify the components
Find defects in the systemFind defects in the system Release testingRelease testing
Validating that the system meets its requirementsValidating that the system meets its requirements Black-box testingBlack-box testing
Also called Also called acceptance testingacceptance testing, if customers are involved, if customers are involved
99Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Integration TestingIntegration Testing
A major problem - localizing errorsA major problem - localizing errors Hard to identify where the error occurredHard to identify where the error occurred
An incremental approachAn incremental approach Initially, integrate a minimal system configuration and Initially, integrate a minimal system configuration and
test this systemtest this system Add components and test after each added incrementAdd components and test after each added increment
Regression testingRegression testing Rerun an existing set of testsRerun an existing set of tests
1010Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Incremental Integration TestingIncremental Integration Testing
T3
T2
T1
T4
T5
A
B
C
D
T2
T1
T3
T4
A
B
C
T1
T2
T3
A
B
Test sequence 1 Test sequence 2 Test sequence 3
1111Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Release TestingRelease Testing
Primary goalPrimary goal Increase the supplier’s confidence that the system Increase the supplier’s confidence that the system
meets its requirementsmeets its requirements
A black-box testingA black-box testing System behavior can be determined by studying its System behavior can be determined by studying its
inputs and related outputsinputs and related outputs Also called functional testingAlso called functional testing
1212Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Black-box TestingBlack-box Testing
IeInput test data
OeOutput test results
System
Inputs causinganomalousbehaviour
Outputs which revealthe presence ofdefects
1313Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
GuidelinesGuidelines
Choose inputs that force the system to generate Choose inputs that force the system to generate all error messagesall error messages
Design inputs that cause input buffers to Design inputs that cause input buffers to overflowoverflow
Repeat the same input or series of inputs Repeat the same input or series of inputs numerous timesnumerous times
Force computation results to be too large or too Force computation results to be too large or too smallsmall
1414Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Performance TestingPerformance Testing
Test the system for emergent properties after Test the system for emergent properties after completely integratedcompletely integrated PerformancePerformance ReliabilityReliability
Performance testsPerformance tests Ensure the system can process its intended loadEnsure the system can process its intended load
1515Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Performance TestingPerformance Testing
Construct an operational profileConstruct an operational profile A set of tests that reflect the actual mix of workA set of tests that reflect the actual mix of work
Stress testingStress testing Making demands that are outside the design limits of Making demands that are outside the design limits of
the softwarethe software Be particular relevant to distributed systems based on Be particular relevant to distributed systems based on
a network of processorsa network of processors
1616Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Performance TestingPerformance Testing
Two functions of the stress testingTwo functions of the stress testing It tests the failure behavior of the systemIt tests the failure behavior of the system It stresses the system and may cause defects of It stresses the system and may cause defects of
come to light that would not normally be discovered.come to light that would not normally be discovered.
1717Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
ContentsContents
23.1 System testing23.1 System testing
23.2 Component testing23.2 Component testing
23.3 Test case design23.3 Test case design
23.4 Test automation23.4 Test automation
1818Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Component TestingComponent Testing
The process of testing individual components in The process of testing individual components in the systemthe system Also called Also called unit testingunit testing
GoalGoal To expose faults in these componentsTo expose faults in these components
For most systemsFor most systems Developers are responsible for component testingDevelopers are responsible for component testing
1919Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Component TestingComponent Testing
Three types of componentsThree types of components Individual functions or methods within an Individual functions or methods within an
objectobject Object classes that have several attributes Object classes that have several attributes
and methodsand methods Composite components made up of several Composite components made up of several
different objects or functions.different objects or functions.
2020Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
ContentsContents
23.1 System testing23.1 System testing
23.2 Component testing23.2 Component testing
23.3 Test case design23.3 Test case design
23.4 Test automation23.4 Test automation
2121Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Test Case DesignTest Case Design
Design test cases (inputs and predicted outputs) Design test cases (inputs and predicted outputs) to test the systemto test the system System testing System testing Component testingComponent testing
GoalGoal Create a set of test casesCreate a set of test cases
Discover program defectsDiscover program defects
Show that the system meets its requirementsShow that the system meets its requirements
2222Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Test Case DesignTest Case Design
Approaches to test case designApproaches to test case design Requirement-based testingRequirement-based testing
Test the system requirementTest the system requirement Mostly at the system-testing stageMostly at the system-testing stage
Partition testingPartition testingIdentify input and output partitionsIdentify input and output partitions
Execute inputs from all partitionsExecute inputs from all partitions Generate outputs in all partitionsGenerate outputs in all partitions
Structured testingStructured testingExercise all parts of the programExercise all parts of the program
2323Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Requirement-based TestingRequirement-based Testing
Testing a requirement does not mean just writing Testing a requirement does not mean just writing a single testa single test Normally several tests are requiredNormally several tests are required e.g. The user shall be able to search either all of the e.g. The user shall be able to search either all of the
initial set of databases or select a subset from it.initial set of databases or select a subset from it.One databaseOne database
Two databasesTwo databases
More than two databasesMore than two databases
A validation testA validation test Rather than a defect testingRather than a defect testing
2424Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Partition TestingPartition Testing
The input data and output results fall into a The input data and output results fall into a number of different classesnumber of different classes Positive numbersPositive numbers Negative numbersNegative numbers
Each of these classes is an Each of these classes is an equivalence partitionequivalence partition or or domaindomain where the program behaves in an where the program behaves in an equivalent way for each class memberequivalent way for each class member Test cases should be chosen from each partitionTest cases should be chosen from each partition
2525Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Partition TestingPartition Testing
System
Outputs
Invalid inputs Valid inputs
2626Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Partition TestingPartition Testing
Identify partitions by using the program Identify partitions by using the program specification or user documentationspecification or user documentation A program accepts 4 to 10 inputs that are five-digit A program accepts 4 to 10 inputs that are five-digit
integers greater than 10,000integers greater than 10,000 A good rule of thumbA good rule of thumb
Boundaries of the partitionsBoundaries of the partitions
Cases close to the mid-point of the partitionCases close to the mid-point of the partition
2727Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Partition TestingPartition Testing
Between 10000 and 99999Less than 10000 More than 99999
999910000 50000
10000099999
Input values
Between 4 and 10Less than 4 More than 10
34 7
1110
Number of input values
2828Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
Structural TestingStructural Testing
To exercise all program statementsTo exercise all program statements not all path combinationsnot all path combinations
Test case designTest case design Derived from knowledge of the software’s structure Derived from knowledge of the software’s structure
and implementationand implementation Also called Also called
‘‘white-box’ testingwhite-box’ testing
‘‘glass-box’ testingglass-box’ testing
‘‘clear-box’ testingclear-box’ testing
2929Ku-Yaw ChangKu-Yaw Chang Software TestingSoftware Testing
ContentsContents
23.1 System testing23.1 System testing
23.2 Component testing23.2 Component testing
23.3 Test case design23.3 Test case design
23.4 Test automation23.4 Test automation
Recommended