0% found this document useful (0 votes)
10 views41 pages

Unit - 4 White and Block Box Testing

The document discusses White Box and Black Box testing methodologies in software testing. White Box testing focuses on the internal structures and logic of the code, ensuring all paths and conditions are tested, while Black Box testing evaluates the software's functionality without knowledge of its internal workings. Various techniques and strategies for both testing types are outlined, including path testing, condition testing, and equivalence partitioning.

Uploaded by

nmknmknmk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views41 pages

Unit - 4 White and Block Box Testing

The document discusses White Box and Black Box testing methodologies in software testing. White Box testing focuses on the internal structures and logic of the code, ensuring all paths and conditions are tested, while Black Box testing evaluates the software's functionality without knowledge of its internal workings. Various techniques and strategies for both testing types are outlined, including path testing, condition testing, and equivalence partitioning.

Uploaded by

nmknmknmk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

White Box Testing

&
1
Black box testing

Dr.Murali Krishna Namana 15/05/2025


2

Dr.Murali Krishna Namana 15/05/2025


3 White Box Testing

White-box testing, sometimes called


clear box testing
glass-box testing,
transparent testing,
structured based testing

Analysis of internal structured of component or system

Dr.Murali Krishna Namana 15/05/2025


4 White Box texting
 White box testing focuses on implementation
 Aim is to exercise different program structures with the
intent of uncovering errors
 Test cases have to be selected to satisfy
coverage criteria
 White Box Testing is the testing of a software
solution's internal coding and infrastructure

Dr.Murali Krishna Namana 15/05/2025


5 White Box texting focused on
guarantee that all independent paths within a module
have been exercised at least once
exercise all logical decisions on their true and false
sides,
Execute all loops at their boundaries and within their
operational bounds,
Exercise internal data structures to ensure their validity

Dr.Murali Krishna Namana 15/05/2025


6

Dr.Murali Krishna Namana 15/05/2025


7 Types of structural testing/ white Box
Testing
 Basic path testing
Flow graph notations
independent program paths
Deriving test cases
Graph metrics
 Control structure testing
Condition testing
Data flow testing
Loop testing

Dr.Murali Krishna Namana 15/05/2025


8 Aim of Basis path testing

 Simply defining the set of execution paths enables the test case
designer to derive a
logical complexity
 The designer measure the logical complexity measure of a
procedural design and
use this measure as a
guide for defining a
basis set of execution
Execution Paths paths.

the specific sequence of instructions


a program follows during its runtime

Dr.Murali Krishna Namana 15/05/2025


9 Basic path testing

proposed by Tom
 Allow the test case designer to derive “logical complexity measure” of a
procedural design

 Use this measure as a guide for the defining a basis set of execution
paths

 Test case derived to exercise basic set to execute every statement in the
program at least one time in testing

Flow Graph Notation


Independent Program
Paths
Dr.Murali Krishna Namana 15/05/2025
Deriving Test Case
Graph Matrices
10 Flow graph notations
 It simply represent the control flow called as flow graph (program graph)
 Each structured build corresponding flow graph symbol
 flow graph shows logical control flows

 Flow chart is used to show program control structure


Dr.Murali
each Krishnacircle
Namana represents  source code statement 15/05/2025
Cyclomatic Complexity-
11 complexity of a code section

 It measures the number of unique paths through the code, indicating


how complex the logic is.
 is the quantitative measure of the number of independent paths
 “defines the number of independent paths”
 Lower complexity suggests simpler, more manageable code, reducing
the chances of errors and making it easier to maintain and modify.
 For example,
 if the source code contains no control flow statement then its cyclomatic
complexity will be 1
 source code contains a single path in it.
 Similarly, if the source code contains one if condition then cyclomatic
complexity will be 2 because there will be two paths one for true and the
other for false.
Dr.Murali Krishna Namana 15/05/2025
12 Flowchart

A flowchart is used to
depict program control
structure

the flowchart into a


corresponding flow
graph

Dr.Murali Krishna Namana 15/05/2025


Each circle, called a flow
graph node, represents one
13 or more procedural
statements

A sequence of process
boxes and a decision
diamond can map into a
single node

The arrows on the flow


graph, called edges or links,
represent flow of control.

An edge must terminate at


a node, even if the node
does not represent any
procedural statements

Areas bounded by edges


and nodes are called
regions
Dr.Murali Krishna Namana 15/05/2025
14
Independent Program Paths

 at least one new set of processing statements or a new


condition.
 independent path must move along at least one edge

To know how many paths


Cyclomatic complexity provides
the answer (software metric)

V(G)= E - N + 2 (E= no of flow


graph edges , N=no of flow
graph nodes. 11-9+2=4
Dr.Murali Krishna Namana
V(G) = P + 1 (P= number of 15/05/2025
predicate nodes ) 3+1=4
15

Dr.Murali Krishna Namana 15/05/2025


16

Each circle – flow graph node, it represents one or more procedural statements

The sequence of procedural boxes and decision diamond can map in to a single node

Arrows called edges


Dr.Murali or links represents flow of control
Krishna Namana 15/05/2025

Every edge must me terminated with a node


17 Independent Program Paths
 Independent Program Paths at least one new set of processing statements or a
new condition

 Path 1: 1-11
 Path 2: 1-2-3-4-5-10-1-11
 Path 3: 1-2-3-6-8-9-10-1-11 Path 4: 1-2-3-6-7-9-10-1-11
 Here each path introduce new edge
 Cyclomatic complexity ( how many paths )
 V(G)= E-N+2 (E is no of flow graph edges , N is no of flow graph nodes
 V(G)= 11 edges -9 nodes +2 = 4

Dr.Murali Krishna Namana 15/05/2025


18 Deriving test cases

 Using design or code as foundation draw a corresponding flow graph


 Determine the Cyclomatic complexity of the flow ghaph
 Determine basic set of linearly independent paths
 Prepare test cases that will force execution of each path in the basic

Dr.Murali Krishna Namana 15/05/2025


19 Graph Metrics

 The procedure to derive the flow graph- determine


the set of basis paths
 To develop a Sw tool that help in basis path testing, data structure ,,
called graph matrix

 graph matrix square matrix ( equal to no of nodes on the flow graph

Dr.Murali Krishna Namana 15/05/2025


20

Dr.Murali Krishna Namana 15/05/2025


21 Control structure testing

Condition testing
Data flow testing
Loop testing

Dr.Murali Krishna Namana 15/05/2025


22 Condition testing

 exercising the logical conditions in a program module


 the logical condition and decision statements are free from errors.
 the errors present in logical conditions can be incorrect boolean
operators, missing parenthesis in a booleans expression, error in
relational operators, arithmetic expressions, and so on.
 Boolean operator error, Boolean variable error, Boolean parenthesis
error, Relational operator error, Arithmetic expression error

Dr.Murali Krishna Namana 15/05/2025


23 Data Flow Testing

 Selects test paths according to the location of definitions and use of


variables. This is a somewhat latest technique.
 Its use should be targeted to modules with nested if and loop
statements.
 The data flow test approach is shows as follows,
 Each statement in a program is assigned a unique statement number
and that theme function cannot modify its parameters or global
variables.

Dr.Murali Krishna Namana 15/05/2025


 example, with S as its statement number.
24  DEF (S) = {X | Statement S has a definition of X}
 USE (S) = {X | Statement S has a use of X}
 If statement S is an if or loop statement, its DEF set is empty and its USE
set is based on the condition of statement S.
 The definition of variable X at statement S is said to be live at statement S'
if there exists a path from statement S to statement S' that contains no
other definition of X.

 Data flow testing strategies are useful for selecting test paths of a program
containing nested if and loop statements

Dr.Murali Krishna Namana 15/05/2025


Loop Testing
 Loop testing is actually a white box testing technique. It specifically focuses
25
on the validity of loop construction.
 types of loops
 Simple Loop, Concatenated Loops, Nested Loops, Unstructured
loops,
1) where n is the maximum number of allowable passes through the loop
2) If independent loops, use simple loop testing.
If dependent, treat as nested loops
3) Loops within loops are called as nested loops, when testing nested loops,
the number of tested increases as level nesting increases.
4) loops should be redesigned, Don't test

Dr.Murali Krishna Namana 15/05/2025


26 following set for simple Loop

 Simple Loop – The following set of test can be applied to simple loops,
where the maximum allowable number through the loop is n.
 Skip the entire loop.
 Traverse the loop only once.
 Traverse the loop two times.
 Make p passes through the loop where p<n.
 Traverse the loop n-1, n, n+1 times.

Dr.Murali Krishna Namana 15/05/2025


27 Steps for Nested Loops

 Nested Loops – Loops within loops are called as nested loops. when
testing nested loops, the number of tested increases as level nesting
increases.
The following steps for testing nested loops are as follows-
 Start with inner loop. set all other loops to minimum values.
 Conduct simple loop testing on inner loop.
 Work outwards.
 Continue until all loops tested

Dr.Murali Krishna Namana 15/05/2025


Black
28
Box Testing
 It is a software testing method in which the functionalities of software
applications are tested without having knowledge of internal code structure,
implementation details and internal paths.
 Black Box Testing mainly focuses on input and output of software applications
and it is entirely based on software requirements and specifications.
 It is also known as Behavioral Testing. closed-box, specification-based or eye-to-
eye testing

Dr.Murali Krishna Namana 15/05/2025


29

 Majority of the applications are tested by Black Box method. We need to


cover the majority of test cases so that most of the bugs will get
discovered by a Black-Box method

Dr.Murali Krishna Namana 15/05/2025


30 Categories of Block box testing

 Incorrect or missing errors


 Interface errors
 Errors in data structures or external database access
 Behavioural or performance errors
 Initialization or termination errors

Dr.Murali Krishna Namana 15/05/2025


31 Test are designed to answer following
questions

Dr.Murali Krishna Namana 15/05/2025


32 Black Box Testing Techniques

 Graph-Based Testing Methods


 Equivalence Partitioning
 Boundary Value Analysis
 Orthogonal array testing

Dr.Murali Krishna Namana 15/05/2025


33 Graph-Based Testing

 This technique of Black box testing


 it involves a graph drawing that depicts the link between the causes
(inputs) and the effects (output), which trigger the effects

Word processing application

Dr.Murali Krishna Namana 15/05/2025


34

 This testing utilizes different combinations of output and inputs.


 It is a helpful technique to understand the software’s functional
performance,
 it visualizes the flow of inputs and outputs in a lively fashion.

Dr.Murali Krishna Namana 15/05/2025


35

 Sw tester begins with creating a graph


 A collected nodes that re[present objects
 Links represents a relationships between objects
 Nodes weights that describe the properties of nodes (data values or
stage behavior )
 links weights represents properties of links

Dr.Murali Krishna Namana 15/05/2025


Equivalence Partitioning
36
 This technique of Black box testing is widely used to write test cases.
 It can be useful in reducing a broad set of possible inputs to smaller but
effective ones.
 It is performed through the division of inputs as classes, and each class is
given a value.

Dr.Murali Krishna Namana 15/05/2025


Equivalence classes defining guidelines
37

Based on above guidelines classes and test cases (data obj) defined
and executed

Dr.Murali Krishna Namana 15/05/2025


38 Boundary Value Analysis
 It is useful and critical Black box testing technique that helps in
equivalence partitioning.
 BVA helps in testing any software having a boundary or extreme values.
 This technique is capable of identifying the flaws of the limits of the input
values rather than focusing on the range of input value

Dr.Murali Krishna Namana 15/05/2025


39 Guidelines for Boundary Value
Analysis

Dr.Murali Krishna Namana 15/05/2025


40 Testing Techniques

 Any application can be tested in one of TWO ways

 Looking the specified function

 Knowing the internal working of product and test can be conducted

Dr.Murali Krishna Namana 15/05/2025


41

Dr.Murali Krishna Namana 15/05/2025

You might also like