SlideShare a Scribd company logo
1 of 62
Download to read offline
1
Software Testing Strategies
Chapter 18
Click here to review SW Testing Techniques
2
Review SW Testing Techniques
Chapter 17
3
Software Testing Techniques
• Provide system guidance for designing tests that:
– Exercise the internal logic of a program
• “White Box” test cases design techniques
– Exercise the input and output “Requirements” of a
program
• “Black Box”
To Uncover ERRORS / BUGS /
MISUNDERSTANDING OF REQUIREMNTS
ETC.
4
Software Testing Techniques
• Execute the program before the customer.
• To reduce the number of errors detected by
customers.
• In order to find the highest possible number
pf errors software testing techniques must
be used
5
Destructive Phase
Constructive Phases
Software Testing Techniques
Analysis Design Implementation Test
Requirement
Spic.
Design
Document
Code Test Cases
6
What is testing and why do we
do it?
• Testing is the filter to catch defects before
they are “discovered” by the customer
– Every time the program is run by a customer, it
generates a “test-case”.
– We want our test cases to find the defects first.
• Software development is a human activity
with huge potential for errors
• Testing before release helps assure quality
and saves money
7
Test Cases Design
•Test cases should be designed to have the highest
likelihood of finding problems
•Can test by either:
–Black-box - using the specifications of what the software
should do
•Tests are derived from the I/O specification.
•Used in most functional tests.
•Other names: data-driven, input/output-driven.
–White-Box - testing internal paths and working of the
software
•Examine internal program structure and derive tests from an
examination of the program’s logic.
•Used to develop test cases for unit and integration testing
•Other names: Glass-box, Logic-driven, Structural.
8
White-Box Testing
• Uses the control structure of the
program/design to derive test cases
• We can derive test cases that:
– Guarantee that all independent paths within a
module have been visited at least once.
– Exercise all logical decisions on their TRUE or
FALSE sides
– Execute all loops at their boundaries
9
A few White-Box Strategies
• Statement
– Requires each statement of the program to be executed
at least once.
• Branch
– Requires each branch to be traversed at least once.
• Multi-condition
– Requires each condition in a branch be evaluated.
10
More White-Box Strategies
• Basis Path
– Execute all control flow paths through the code. Based
on Graph Theory.
• Thomas McCabe’s Cyclomatic Complexity:
• V(g) : #edges - #nodes + 2
• Cyclomatic complexity is a SW metric that measures the
complexity of a program.
• The larger V(g) the more complex.
• Data Flow
– Selects test data based on the locations of definition and
the use of variables.
11
Statement Coverage
• The criterion is to require every statement in
the program to be executed at least once
• Weakest of the white-box tests.
• Specified by the F.D.A. as the minimum
level of testing.
12
Branch Coverage
• This criterion requires enough test cases such that
each decision has a TRUE and FALSE outcome at
least once.
• Another name: Decision coverage
• More comprehensive than statement coverage.
13
Branch Coverage
• Example:
void example(int a, int b, float *x)
{
1 if ((a>1) && (b==0))
2 x /= a;
3 if ((a==2) || (x > 1)
4 x++;
}
• Test case(s)
1. a=2, b=0, x=3
2. a=3, b=1, x=1
14
Branch Coverage
•Test Case
1. a=2, b=0 & x=3
2. a=3, b=1 & x=1
•Coverage
1. ace
2. abd
•What happens with data
that takes:
–abe, or
–acd
a > 1
&&
b==0
x /= a;
a
b
c
d
e
Yes
a==2
||
x > 1
No
x++
Yes
No
15
Basis Path
•Execute all independent flow paths through the code.
Based on a flow graph.
–An independent flow path is one that introduces at least 1 new
set of statements or conditions
–Must move along at least 1 new edge on flow graph
–Flow graph shows the logical control flow using following
notation:
Sequence If
while
until
16
Corresponding
Flow Graph
i=1;
total.input =
total.valid = 0;
sum = 0;
value[i] <> -
999
total.input <
100
total.input ++;
value[i] >=
min &&
value[i] <=
max
sum=sum+valu
e[i];
i++;
Enddo
total.valid >
0
aver = sum/
total.valid;
aver=-999
no
N
o Yes
Yes
No -
Done
1.
4.
3.
2.
5.
6.
7.
8.
9.
10.
11. 12.
13.
1
2
3
4
6
5
7
8
9
10
11
12
13
17
Number of Paths
1
2
3
4
6
5
7
8
9
10
11
12
13
V(g) = E - N + 2
17-13 + 2 = 6
R = 6
R1
R3
R2
R4
R5
R6
18
Black-Box Testing
• Focuses on functional requirements of the software
without regard to the internal structure.
• data-driven, input/output-driven or behavior testing
• Used in most system level testing
– Functional,
– Performance
– Recovery
– Security & stress
• Tests set up to exercise full functional requirements of
system
19
Black Box Testing Find Errors in ...
• Incorrect or missing functions (compare to white
box)
• Interface errors
• Errors in External Data structures
• Behavior performance problems (Combinations of
input make it behave poorly).
• Initialization and Termination errors (Sensitive to
certain inputs (e.g., performance)
• Blackbox done much later in process than white
box.
20
A few Black-box Strategies
• Exhaustive input testing
– A test strategy that uses every possible input condition
as a test case.
– Ideal
– Not possible!
• Random
– Test cases are created from a pseudo random generator.
– Broad spectrum. Not focused.
– Hard to determine the result of the test.
21
Black-box Strategies
• Equivalence Partitioning
– A black-box testing method that divides the
input domain of a program into classes of data
which test cases can be derived.
• Boundary Value Analysis
– A test case design technique that complements
equivalence partitioning, by selecting test cases
at the “edges” of the class.
22
Boundary Value Analysis
• Experience shows that test cases exploring
boundary conditions have a high payoff.
– E.g., Most program errors occur in loop control.
• Different from equivalence partitioning:
– Rather than any element in class, BVA selects tests at
edge of the class.
– In addition to input condition, test cases can be derived
for output conditions.
• Similar to Equivalence partitioning. First identify
Equivalence classes, then look at the boundaries.
23
Test Case Documentation
• Minimum information for a test case
– Identifier
– Input data
– Expected output data
• Recommended to add the condition being tested
(hypothesis).
• Format of test case document changes depending
on what is being tested.
• Always include design worksheets.
24
Simple Test Case Format
Id Condition Input Data Expected
25
Test Case Formats
• Testing worksheet
– Test Case
• Identifier (serial number)
• Condition (narrative or predicate)
• Input (Stimuli data or action)
• Expected Output (Results)
– Test Results
• Actual Output (Results)
• Status (Pass/Fail)
26
Use this Test Case format for
your Project
Test Name/Number
Test Objective
Test Description
Test Conditions
Expected Results
Actual Results
27
ANSI/IEEE Test Case Outline
• Test-case-specification Identifier
– A unique identifier
• Test Items
– Identify and briefly describe the items and features to
be exercised by this case
• Input Specifications
– Specify each input required to execute the test case.
• Output Specifications
– Specify all of the outputs and features required of the
test items.
28
ANSI/IEEE Test Case Outline
• Environmental needs
– Hardware
– Software
– Other
• Special procedural requirements
– Describe any special constraints on the test procedures
which execute this test case.
• Interfaces dependencies
– List the id’s of test cases which must be executed prior
to this test case
29
Software Testing Strategies
Chapter 18
30
Software Testing Strategies
• A formal plan for your tests.
– What to test ?
– What to test when new components are added
to the system?
– When to start testing with customer?
• Testing is a set of activities that can be
planned in advance and conducted
systematically.
31
Software Testing Strategies
• Testing begins “in the small” and
progresses “to the large”.
• Start with a single component and move
upward until you test the whole system.
• Early tests detects design and
implementation errors, as move upward you
start uncover errors in requirements .
32
Software Testing Strategies
• Characteristics of testing strategies:
– Testing begins at the component level, for OO at the
class or object level, and works outward toward the
integration of the entire system.
– Different testing techniques, such as white-box and
black-box, are appropriate at different times in the
testing process.
– For small projects, testing is conducted by the
developers. For large projects, an independent testing
group is recommended.
– Testing and debugging are different activities, but
debugging must be included in any testing strategy.
33
Testing can be used for verification and
validation (V&V) of the Software:
• Verification - Are
we building the
product right?
– Did the software
correctly implements a
specific function.
• Validation - Are we
building the right
product?
– Has the software
been built to
customer
requirements “Trace-
ability”
The goal is to make sure that the software meets the
organization quality measures
34
Conventional SW Testing can be
viewed as a series of four steps:
Analysis Design Implementation
Integration
Testing
Unit
Testing
System
Testing &
Validation
Testing
System
Engineering
35
Unit Testing
• Testing focuses on each component “unit”
individually.
• Unit testing heavily depends on white-box
testing techniques.
– Tests of all components can be conducted in parallel.
– Use the component level design description, found in
the design document, as a guide to testing.
36
Unit Testing
• Things to consider as you write test cases for
each component:
– Interface to the module - does information flow in and out
properly?
– Local data structures - do local structures maintain data
correctly during the algorithms execution?
– Boundary conditions - all boundary conditions should be
tested. Look at loops, First and last record processed, limits of
arrays… This is where you will find most of your errors.
– Independent paths- Try to execute each statement at least
once. Look at all the paths through the module.
– Error Handling paths- Trigger all possible errors and see that
they are handled properly,
• messages are helpful and correct,
• exception-condition processing is correct and
• error messages identify the location of the true error.
37
Unit Testing
• Things to consider as you write test cases for
each component:
– Stubs and Drivers:
• Additional SW used to help test components.
– Driver –
• a main program that passes data to the component and
displays or prints the results.
– Stub -
• a "dummy" sub-component or sub-program used to replace
components/programs that are subordinate to the unit being
tested.
• The stub may do minimal data manipulation, print or display
something when it is called and then return control to the unit
being tested.
38
Stubs and Drivers
Driver
Module to be
tested
Stub
Stub
Results
39
Conventional SW Testing can be
viewed as a series of four steps:
Analysis Design Implementation
Integration
Testing
Unit
Testing
System
Testing &
Validation
Testing
System
Engineering
40
Integration Testing
• Testing focuses on the design and the
construction of the SW architecture.
– This is when we fit the units together.
• Integration testing includes both
– verification and
– program construction.
• Black-box testing techniques are mostly used.
Some white-box testing may be used for major control paths.
– Look to the SW design specification for
information to build test cases.
41
Integration Testing
• Different approaches to Integration:
– Top-down
– Bottom-up
– Sandwich
– Big Bang!
42
Top-down Approach
• Modules are integrated by moving down
through the control hierarchy, beginning with
the main program.
• Two approaches to Top-down integration:
– Depth-first integration –
• Integrate all components on a major control path.
– Breadth-first integration –
• Integrates all components at a level and then moves
down.
43
Top-down Integration Steps
• Main is used as a test driver and stubs are
used for all other components
• Replace sub-ordinate stubs one at a time (the
order depends on approach used depth or
breadth) with actual components.
• retest as each component is integrated.
• On completion of a set of tests replace stubs
• To regret ion testing to make sure new
modules didn't introduce new errors
44
Depth-first Example
M1
M2
M6
M5
M3 M4
45
Breadth-first integration
M1
M2
M6
M5
M3 M4
Stub As You Go
46
Top-down Integration
• Advantages:
– Major control is tested
first, since decision
making is usually found
in upper levels of the
hierarchy.
– If depth-first is used, a
complete function of the
SW will be available for
demonstration.
• Disadvantages:
– Many stubs may be
needed.
– Testing may be limited
because stubs are
simple. They do not
perform functionality of
true modules.
47
Integration Testing
• Different approaches to Integration:
– Top-down
– Bottom-up
– Sandwich
– Big Bang!
48
Bottom-up Approach
• Construction and testing begins at the lowest
levels in the program structure.
• Implemented through the following steps:
1. Low level components are combined into clusters or
builds that perform a specific SW function.
2. A Driver is written to control the test case input and
output.
3. The cluster or build is tested.
4. Drivers are removed and the clusters or builds are
combined moving upward in the program structure.
– GOTO TEXTBOOK PAGE 491
49
Bottom-up Approach
• Advantages:
– Not need or for
stubs.
• Disadvantage:
– Controllers needed
50
Integration Testing
• Different approaches to Integration:
– Top-down
– Bottom-up
– Sandwich
– Big Bang!
51
Sandwich approach
• The sandwich approach is the best of
both worlds, and minimizes the need for
drivers and stubs.
• A top-down approach is used for the top
components and bottom-up is used for
the lower levels.
52
Big Bang approach
• Put the whole system together and
watch the fire works!
– (Approach used by may under-grads.)
– Avoid this, and choose a strategy.
53
Regression Testing
• Each time the software changes I.e when
new component is added.
• To make sure that new changes didn’t break
existing functionality that used to work fine.
• Re-Execute some tests to capture errors as a
result of side effects of new changes.
54
Validation Testing
Validation of the requirements
55
Validation Testing
• Testing ensures that all functional, behavioral
and performance requirements of the system
were satisfied.
– These were detailed in the SW requirements
specification.
– Look in the validation criteria section.
• Only Black-box testing techniques are used.
• The goal is to prove conformity with the
requirements.
56
Validation Testing
• For each test case, one of two possibilities
conditions will exist:
1. The test for the function or performance criteria
will conform to the specification and is accepted.
2. A deviation will exist and a deficiency is
uncovered.
– This could be an error in the SW or a
deviation from the specification
– SW works but it does not do what was
expected.
57
Validation Testing
• Alpha and Beta Testing
– A series of acceptance tests to enable the
customer to validate all requirements.
– Conducted by the end users and not the
developer/tester/system engineer.
• Alpha
– At the developer site by customer
• Bets
– At the customer site by the end user.
– Live testing
58
System Testing
Verifies that the new SW system
integrates with the existing
environment. This may include
other systems, hardware, people
and databases.
59
System Testing
• Black-box testing techniques are used.
• Put your software in action with the reset of
the system.
• Many types of errors could be detected but
who will accept responsibility?
60
System Testing Types
• Recovery Testing - force the SW to fail in a
number of ways and verify that it recovers properly
and in the appropriate amount of time.
• Security Testing - attempt to break the security
of the system.
• Stress Testing- execute the system in a way that
requires an abnormal demand on the quantity,
frequency or volume of resources.
• Performance Testing- For real-time and
embedded systems, test the run-time performance of
the system.
61
System Testing Types
• Regression Testing again
– re-executing a subset of all test cases that
have already been conducted to make sure we
have not introduced new defects.
62
Click here for OO Testing
Chapter 23

More Related Content

Similar to Class9_SW_Testing_Strategies.pdf

Object oriented testing
Object oriented testingObject oriented testing
Object oriented testingHaris Jamil
 
Dynamic Testing
Dynamic TestingDynamic Testing
Dynamic TestingJimi Patel
 
Mt s11 test_design
Mt s11 test_designMt s11 test_design
Mt s11 test_designTestingGeeks
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design Jayant Dalvi
 
Lecture (Software Testing).pptx
Lecture (Software Testing).pptxLecture (Software Testing).pptx
Lecture (Software Testing).pptxskknowledge
 
Seii unit6 software-testing-techniques
Seii unit6 software-testing-techniquesSeii unit6 software-testing-techniques
Seii unit6 software-testing-techniquesAhmad sohail Kakar
 
Newsoftware testing-techniques-141114004511-conversion-gate01
Newsoftware testing-techniques-141114004511-conversion-gate01Newsoftware testing-techniques-141114004511-conversion-gate01
Newsoftware testing-techniques-141114004511-conversion-gate01Mr. Jhon
 
Software Engineering (Testing Overview)
Software Engineering (Testing Overview)Software Engineering (Testing Overview)
Software Engineering (Testing Overview)ShudipPal
 
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptxabhivastrad007
 
Software Testing & Debugging
Software Testing & DebuggingSoftware Testing & Debugging
Software Testing & DebuggingComputing Cage
 
Object Oriented Testing(OOT) presentation slides
Object Oriented Testing(OOT) presentation slidesObject Oriented Testing(OOT) presentation slides
Object Oriented Testing(OOT) presentation slidesPunjab University
 

Similar to Class9_SW_Testing_Strategies.pdf (20)

Object oriented testing
Object oriented testingObject oriented testing
Object oriented testing
 
Introduction to White box testing
Introduction to White box testingIntroduction to White box testing
Introduction to White box testing
 
Dynamic Testing
Dynamic TestingDynamic Testing
Dynamic Testing
 
Mt s11 test_design
Mt s11 test_designMt s11 test_design
Mt s11 test_design
 
G53 qat09pdf6up
G53 qat09pdf6upG53 qat09pdf6up
G53 qat09pdf6up
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Lecture (Software Testing).pptx
Lecture (Software Testing).pptxLecture (Software Testing).pptx
Lecture (Software Testing).pptx
 
Seii unit6 software-testing-techniques
Seii unit6 software-testing-techniquesSeii unit6 software-testing-techniques
Seii unit6 software-testing-techniques
 
Newsoftware testing-techniques-141114004511-conversion-gate01
Newsoftware testing-techniques-141114004511-conversion-gate01Newsoftware testing-techniques-141114004511-conversion-gate01
Newsoftware testing-techniques-141114004511-conversion-gate01
 
ISTQB foundation level - day 2
ISTQB foundation level - day 2ISTQB foundation level - day 2
ISTQB foundation level - day 2
 
Software Engineering (Testing Overview)
Software Engineering (Testing Overview)Software Engineering (Testing Overview)
Software Engineering (Testing Overview)
 
Testing
TestingTesting
Testing
 
Testing
TestingTesting
Testing
 
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
 
Software Testing & Debugging
Software Testing & DebuggingSoftware Testing & Debugging
Software Testing & Debugging
 
L software testing
L   software testingL   software testing
L software testing
 
Testing
TestingTesting
Testing
 
Object Oriented Testing(OOT) presentation slides
Object Oriented Testing(OOT) presentation slidesObject Oriented Testing(OOT) presentation slides
Object Oriented Testing(OOT) presentation slides
 
Unit 6
Unit 6Unit 6
Unit 6
 
Software testing
Software testingSoftware testing
Software testing
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Class9_SW_Testing_Strategies.pdf

  • 1. 1 Software Testing Strategies Chapter 18 Click here to review SW Testing Techniques
  • 2. 2 Review SW Testing Techniques Chapter 17
  • 3. 3 Software Testing Techniques • Provide system guidance for designing tests that: – Exercise the internal logic of a program • “White Box” test cases design techniques – Exercise the input and output “Requirements” of a program • “Black Box” To Uncover ERRORS / BUGS / MISUNDERSTANDING OF REQUIREMNTS ETC.
  • 4. 4 Software Testing Techniques • Execute the program before the customer. • To reduce the number of errors detected by customers. • In order to find the highest possible number pf errors software testing techniques must be used
  • 5. 5 Destructive Phase Constructive Phases Software Testing Techniques Analysis Design Implementation Test Requirement Spic. Design Document Code Test Cases
  • 6. 6 What is testing and why do we do it? • Testing is the filter to catch defects before they are “discovered” by the customer – Every time the program is run by a customer, it generates a “test-case”. – We want our test cases to find the defects first. • Software development is a human activity with huge potential for errors • Testing before release helps assure quality and saves money
  • 7. 7 Test Cases Design •Test cases should be designed to have the highest likelihood of finding problems •Can test by either: –Black-box - using the specifications of what the software should do •Tests are derived from the I/O specification. •Used in most functional tests. •Other names: data-driven, input/output-driven. –White-Box - testing internal paths and working of the software •Examine internal program structure and derive tests from an examination of the program’s logic. •Used to develop test cases for unit and integration testing •Other names: Glass-box, Logic-driven, Structural.
  • 8. 8 White-Box Testing • Uses the control structure of the program/design to derive test cases • We can derive test cases that: – Guarantee that all independent paths within a module have been visited at least once. – Exercise all logical decisions on their TRUE or FALSE sides – Execute all loops at their boundaries
  • 9. 9 A few White-Box Strategies • Statement – Requires each statement of the program to be executed at least once. • Branch – Requires each branch to be traversed at least once. • Multi-condition – Requires each condition in a branch be evaluated.
  • 10. 10 More White-Box Strategies • Basis Path – Execute all control flow paths through the code. Based on Graph Theory. • Thomas McCabe’s Cyclomatic Complexity: • V(g) : #edges - #nodes + 2 • Cyclomatic complexity is a SW metric that measures the complexity of a program. • The larger V(g) the more complex. • Data Flow – Selects test data based on the locations of definition and the use of variables.
  • 11. 11 Statement Coverage • The criterion is to require every statement in the program to be executed at least once • Weakest of the white-box tests. • Specified by the F.D.A. as the minimum level of testing.
  • 12. 12 Branch Coverage • This criterion requires enough test cases such that each decision has a TRUE and FALSE outcome at least once. • Another name: Decision coverage • More comprehensive than statement coverage.
  • 13. 13 Branch Coverage • Example: void example(int a, int b, float *x) { 1 if ((a>1) && (b==0)) 2 x /= a; 3 if ((a==2) || (x > 1) 4 x++; } • Test case(s) 1. a=2, b=0, x=3 2. a=3, b=1, x=1
  • 14. 14 Branch Coverage •Test Case 1. a=2, b=0 & x=3 2. a=3, b=1 & x=1 •Coverage 1. ace 2. abd •What happens with data that takes: –abe, or –acd a > 1 && b==0 x /= a; a b c d e Yes a==2 || x > 1 No x++ Yes No
  • 15. 15 Basis Path •Execute all independent flow paths through the code. Based on a flow graph. –An independent flow path is one that introduces at least 1 new set of statements or conditions –Must move along at least 1 new edge on flow graph –Flow graph shows the logical control flow using following notation: Sequence If while until
  • 16. 16 Corresponding Flow Graph i=1; total.input = total.valid = 0; sum = 0; value[i] <> - 999 total.input < 100 total.input ++; value[i] >= min && value[i] <= max sum=sum+valu e[i]; i++; Enddo total.valid > 0 aver = sum/ total.valid; aver=-999 no N o Yes Yes No - Done 1. 4. 3. 2. 5. 6. 7. 8. 9. 10. 11. 12. 13. 1 2 3 4 6 5 7 8 9 10 11 12 13
  • 17. 17 Number of Paths 1 2 3 4 6 5 7 8 9 10 11 12 13 V(g) = E - N + 2 17-13 + 2 = 6 R = 6 R1 R3 R2 R4 R5 R6
  • 18. 18 Black-Box Testing • Focuses on functional requirements of the software without regard to the internal structure. • data-driven, input/output-driven or behavior testing • Used in most system level testing – Functional, – Performance – Recovery – Security & stress • Tests set up to exercise full functional requirements of system
  • 19. 19 Black Box Testing Find Errors in ... • Incorrect or missing functions (compare to white box) • Interface errors • Errors in External Data structures • Behavior performance problems (Combinations of input make it behave poorly). • Initialization and Termination errors (Sensitive to certain inputs (e.g., performance) • Blackbox done much later in process than white box.
  • 20. 20 A few Black-box Strategies • Exhaustive input testing – A test strategy that uses every possible input condition as a test case. – Ideal – Not possible! • Random – Test cases are created from a pseudo random generator. – Broad spectrum. Not focused. – Hard to determine the result of the test.
  • 21. 21 Black-box Strategies • Equivalence Partitioning – A black-box testing method that divides the input domain of a program into classes of data which test cases can be derived. • Boundary Value Analysis – A test case design technique that complements equivalence partitioning, by selecting test cases at the “edges” of the class.
  • 22. 22 Boundary Value Analysis • Experience shows that test cases exploring boundary conditions have a high payoff. – E.g., Most program errors occur in loop control. • Different from equivalence partitioning: – Rather than any element in class, BVA selects tests at edge of the class. – In addition to input condition, test cases can be derived for output conditions. • Similar to Equivalence partitioning. First identify Equivalence classes, then look at the boundaries.
  • 23. 23 Test Case Documentation • Minimum information for a test case – Identifier – Input data – Expected output data • Recommended to add the condition being tested (hypothesis). • Format of test case document changes depending on what is being tested. • Always include design worksheets.
  • 24. 24 Simple Test Case Format Id Condition Input Data Expected
  • 25. 25 Test Case Formats • Testing worksheet – Test Case • Identifier (serial number) • Condition (narrative or predicate) • Input (Stimuli data or action) • Expected Output (Results) – Test Results • Actual Output (Results) • Status (Pass/Fail)
  • 26. 26 Use this Test Case format for your Project Test Name/Number Test Objective Test Description Test Conditions Expected Results Actual Results
  • 27. 27 ANSI/IEEE Test Case Outline • Test-case-specification Identifier – A unique identifier • Test Items – Identify and briefly describe the items and features to be exercised by this case • Input Specifications – Specify each input required to execute the test case. • Output Specifications – Specify all of the outputs and features required of the test items.
  • 28. 28 ANSI/IEEE Test Case Outline • Environmental needs – Hardware – Software – Other • Special procedural requirements – Describe any special constraints on the test procedures which execute this test case. • Interfaces dependencies – List the id’s of test cases which must be executed prior to this test case
  • 30. 30 Software Testing Strategies • A formal plan for your tests. – What to test ? – What to test when new components are added to the system? – When to start testing with customer? • Testing is a set of activities that can be planned in advance and conducted systematically.
  • 31. 31 Software Testing Strategies • Testing begins “in the small” and progresses “to the large”. • Start with a single component and move upward until you test the whole system. • Early tests detects design and implementation errors, as move upward you start uncover errors in requirements .
  • 32. 32 Software Testing Strategies • Characteristics of testing strategies: – Testing begins at the component level, for OO at the class or object level, and works outward toward the integration of the entire system. – Different testing techniques, such as white-box and black-box, are appropriate at different times in the testing process. – For small projects, testing is conducted by the developers. For large projects, an independent testing group is recommended. – Testing and debugging are different activities, but debugging must be included in any testing strategy.
  • 33. 33 Testing can be used for verification and validation (V&V) of the Software: • Verification - Are we building the product right? – Did the software correctly implements a specific function. • Validation - Are we building the right product? – Has the software been built to customer requirements “Trace- ability” The goal is to make sure that the software meets the organization quality measures
  • 34. 34 Conventional SW Testing can be viewed as a series of four steps: Analysis Design Implementation Integration Testing Unit Testing System Testing & Validation Testing System Engineering
  • 35. 35 Unit Testing • Testing focuses on each component “unit” individually. • Unit testing heavily depends on white-box testing techniques. – Tests of all components can be conducted in parallel. – Use the component level design description, found in the design document, as a guide to testing.
  • 36. 36 Unit Testing • Things to consider as you write test cases for each component: – Interface to the module - does information flow in and out properly? – Local data structures - do local structures maintain data correctly during the algorithms execution? – Boundary conditions - all boundary conditions should be tested. Look at loops, First and last record processed, limits of arrays… This is where you will find most of your errors. – Independent paths- Try to execute each statement at least once. Look at all the paths through the module. – Error Handling paths- Trigger all possible errors and see that they are handled properly, • messages are helpful and correct, • exception-condition processing is correct and • error messages identify the location of the true error.
  • 37. 37 Unit Testing • Things to consider as you write test cases for each component: – Stubs and Drivers: • Additional SW used to help test components. – Driver – • a main program that passes data to the component and displays or prints the results. – Stub - • a "dummy" sub-component or sub-program used to replace components/programs that are subordinate to the unit being tested. • The stub may do minimal data manipulation, print or display something when it is called and then return control to the unit being tested.
  • 38. 38 Stubs and Drivers Driver Module to be tested Stub Stub Results
  • 39. 39 Conventional SW Testing can be viewed as a series of four steps: Analysis Design Implementation Integration Testing Unit Testing System Testing & Validation Testing System Engineering
  • 40. 40 Integration Testing • Testing focuses on the design and the construction of the SW architecture. – This is when we fit the units together. • Integration testing includes both – verification and – program construction. • Black-box testing techniques are mostly used. Some white-box testing may be used for major control paths. – Look to the SW design specification for information to build test cases.
  • 41. 41 Integration Testing • Different approaches to Integration: – Top-down – Bottom-up – Sandwich – Big Bang!
  • 42. 42 Top-down Approach • Modules are integrated by moving down through the control hierarchy, beginning with the main program. • Two approaches to Top-down integration: – Depth-first integration – • Integrate all components on a major control path. – Breadth-first integration – • Integrates all components at a level and then moves down.
  • 43. 43 Top-down Integration Steps • Main is used as a test driver and stubs are used for all other components • Replace sub-ordinate stubs one at a time (the order depends on approach used depth or breadth) with actual components. • retest as each component is integrated. • On completion of a set of tests replace stubs • To regret ion testing to make sure new modules didn't introduce new errors
  • 46. 46 Top-down Integration • Advantages: – Major control is tested first, since decision making is usually found in upper levels of the hierarchy. – If depth-first is used, a complete function of the SW will be available for demonstration. • Disadvantages: – Many stubs may be needed. – Testing may be limited because stubs are simple. They do not perform functionality of true modules.
  • 47. 47 Integration Testing • Different approaches to Integration: – Top-down – Bottom-up – Sandwich – Big Bang!
  • 48. 48 Bottom-up Approach • Construction and testing begins at the lowest levels in the program structure. • Implemented through the following steps: 1. Low level components are combined into clusters or builds that perform a specific SW function. 2. A Driver is written to control the test case input and output. 3. The cluster or build is tested. 4. Drivers are removed and the clusters or builds are combined moving upward in the program structure. – GOTO TEXTBOOK PAGE 491
  • 49. 49 Bottom-up Approach • Advantages: – Not need or for stubs. • Disadvantage: – Controllers needed
  • 50. 50 Integration Testing • Different approaches to Integration: – Top-down – Bottom-up – Sandwich – Big Bang!
  • 51. 51 Sandwich approach • The sandwich approach is the best of both worlds, and minimizes the need for drivers and stubs. • A top-down approach is used for the top components and bottom-up is used for the lower levels.
  • 52. 52 Big Bang approach • Put the whole system together and watch the fire works! – (Approach used by may under-grads.) – Avoid this, and choose a strategy.
  • 53. 53 Regression Testing • Each time the software changes I.e when new component is added. • To make sure that new changes didn’t break existing functionality that used to work fine. • Re-Execute some tests to capture errors as a result of side effects of new changes.
  • 55. 55 Validation Testing • Testing ensures that all functional, behavioral and performance requirements of the system were satisfied. – These were detailed in the SW requirements specification. – Look in the validation criteria section. • Only Black-box testing techniques are used. • The goal is to prove conformity with the requirements.
  • 56. 56 Validation Testing • For each test case, one of two possibilities conditions will exist: 1. The test for the function or performance criteria will conform to the specification and is accepted. 2. A deviation will exist and a deficiency is uncovered. – This could be an error in the SW or a deviation from the specification – SW works but it does not do what was expected.
  • 57. 57 Validation Testing • Alpha and Beta Testing – A series of acceptance tests to enable the customer to validate all requirements. – Conducted by the end users and not the developer/tester/system engineer. • Alpha – At the developer site by customer • Bets – At the customer site by the end user. – Live testing
  • 58. 58 System Testing Verifies that the new SW system integrates with the existing environment. This may include other systems, hardware, people and databases.
  • 59. 59 System Testing • Black-box testing techniques are used. • Put your software in action with the reset of the system. • Many types of errors could be detected but who will accept responsibility?
  • 60. 60 System Testing Types • Recovery Testing - force the SW to fail in a number of ways and verify that it recovers properly and in the appropriate amount of time. • Security Testing - attempt to break the security of the system. • Stress Testing- execute the system in a way that requires an abnormal demand on the quantity, frequency or volume of resources. • Performance Testing- For real-time and embedded systems, test the run-time performance of the system.
  • 61. 61 System Testing Types • Regression Testing again – re-executing a subset of all test cases that have already been conducted to make sure we have not introduced new defects.
  • 62. 62 Click here for OO Testing Chapter 23