MODULE 3 Software Testing notes
MODULE 3 Software Testing notes
prime paths through a program be executed at least once. A prime path is a path that is not
a proper subpath of any other path.
For example, let's say we have a program with the following code:
Code snippet
if (x > 0) {
y = x + 1;
} else {
y = x - 1;
}
The first path is a prime path, but the second path is not a prime path because it is a proper
subpath of the first path.
PPC is a stronger coverage criterion than path coverage. It can be used to identify potential
problems with the way that a program handles different paths through the code. However, it
is still not a complete coverage criterion, and it may not be sufficient to find all potential
problems in a program.
Prime path coverage can be used in conjunction with other coverage criteria, such as
statement coverage and branch coverage, to provide a more complete picture of the testing
of a program.
● Use a variety of testing techniques. There are many different types of testing
techniques, such as black-box testing, white-box testing, and boundary-value testing.
Using a variety of techniques can help you to find a wider range of errors.
● Test the software under different conditions. The software should be tested under a
variety of conditions, such as different operating systems, different hardware
configurations, and different data sets. Testing the software under different conditions
can help you to find errors that are only triggered by certain conditions.
● Get feedback from users. Once the functional testing is complete, you should get
feedback from users. This feedback can help you to identify any usability issues with
the software.
By following these tips, you can help to ensure that your prime path coverage is effective
and that your software is free of errors.
Edge coverage (also known as edge-path coverage) is a software testing coverage criterion
that focuses on the edges (or arcs) in a graph. It requires that all of the edges in the graph
be covered by at least one test case.
For example, let's say we have a graph with the following nodes and edges:
Code snippet
A
B
C
D
E
A -> B
B -> C
C -> D
D -> E
Edge coverage would require that we create at least one test case that follows each of these
edges. For example, we could create a test case that starts at node A, goes to node B, then
goes to node C, and so on.
Edge coverage is a stronger coverage criterion than node coverage. It can be used to
identify potential problems with the way that a program handles different paths through a
graph. However, it is still not a complete coverage criterion, and it may not be sufficient to
find all potential problems in a program.
● It is not a complete coverage criterion, and it may not be sufficient to find all potential
problems in a program.
● It can be time-consuming to create test cases that cover all of the edges in a large
graph.
Edge coverage can be used in conjunction with other coverage criteria, such as path
coverage, to provide a more complete picture of the testing of a program.
Edge pair coverage (EPC) is a software testing coverage criterion that focuses on the pairs
of edges in a graph. It requires that all of the pairs of edges in the graph be covered by at
least one test case.
For example, let's say we have a graph with the following nodes and edges:
Code snippet
A
B
C
D
E
A -> B
B -> C
C -> D
D -> E
Edge pair coverage would require that we create at least one test case that follows each of
the following pairs of edges:
Edge pair coverage is a stronger coverage criterion than edge coverage. It can be used to
identify potential problems with the way that a program handles different paths through a
graph. However, it is still not a complete coverage criterion, and it may not be sufficient to
find all potential problems in a program.
● It is not a complete coverage criterion, and it may not be sufficient to find all potential
problems in a program.
● It can be more time-consuming to create test cases that cover all of the edge pairs in
a large graph.
Edge pair coverage can be used in conjunction with other coverage criteria, such as path
coverage, to provide a more complete picture of the testing of a program.
Node coverage, edge coverage, and prime path coverage are all structural coverage
criteria used in software testing. They are all based on the control flow graph (CFG) of a
program, which is a graphical representation of the program's flow of control.
● Node coverage requires that every node in the CFG be executed by at least one test
case. This means that every statement in the program must be executed at least
once.
● Edge coverage requires that every edge in the CFG be traversed by at least one
test case. This means that every possible path through the program must be
executed at least once.
● Prime path coverage is a more stringent coverage criterion than node coverage or
edge coverage. It requires that every prime path in the CFG be executed by at least
one test case. A prime path is a path through the CFG that cannot be broken down
into two shorter paths.
Code snippet
START
IF (x > 0)
PRINT "x is positive"
ELSE
PRINT "x is not positive"
END IF
RETURN
● Node coverage would be satisfied if a test case executed all 5 nodes in the CFG. For
example, a test case could pass in the value 1 for x and check that the output is "x is
positive".
● Edge coverage would be satisfied if a test case traversed all 4 edges in the CFG. For
example, a test case could pass in the value 1 for x and check that the output is "x is
positive", and then pass in the value 0 for x and check that the output is "x is not
positive".
● Prime path coverage would be satisfied if a test case executed every prime path in
the CFG. For example, a test case could pass in the value 1 for x and check that the
output is "x is positive", and then pass in the value -1 for x and check that the output
is "x is not positive".
Node coverage, edge coverage, and prime path coverage are all important coverage criteria
that can help to improve the quality of software. However, no single coverage criterion is
perfect, and it is often necessary to use a combination of coverage criteria to achieve a high
level of test coverage.
Path coverage is a software testing coverage criterion that focuses on the paths through a
program. It requires that all of the paths through the program be covered by at least one test
case.
For example, let's say we have a program with the following code:
Code snippet
if (x > 0) {
y = x + 1;
} else {
y = x - 1;
}
Path coverage would require that we create at least one test case that follows each of these
paths. For example, we could create a test case with x = 1 and another test case with x = -1.
Path coverage is a strong coverage criterion. It can be used to identify potential problems
with the way that a program handles different paths through the code. However, it is not a
complete coverage criterion, and it may not be sufficient to find all potential problems in a
program.
Path coverage can be used in conjunction with other coverage criteria, such as statement
coverage and branch coverage, to provide a more complete picture of the testing of a
program.
Complete path coverage (CPC) is a software testing coverage criterion that requires that
all possible paths through a program be executed at least once. It is the most
comprehensive coverage criterion, and it can be used to identify potential problems with the
way that a program handles different paths through the code.
However, CPC is also the most difficult coverage criterion to achieve, and it can be time-
consuming and expensive to create test cases that cover all possible paths in a large
program.
Complete path coverage can be used in conjunction with other coverage criteria, such as
statement coverage and branch coverage, to provide a more complete picture of the testing
of a program.
● Use a variety of testing techniques. There are many different types of testing
techniques, such as black-box testing, white-box testing, and boundary-value testing.
Using a variety of techniques can help you to find a wider range of errors.
● Test the software under different conditions. The software should be tested under a
variety of conditions, such as different operating systems, different hardware
configurations, and different data sets. Testing the software under different conditions
can help you to find errors that are only triggered by certain conditions.
● Get feedback from users. Once the functional testing is complete, you should get
feedback from users. This feedback can help you to identify any usability issues with
the software.
By following these tips, you can help to ensure that your complete path coverage is effective
and that your software is free of errors.
. Complete round trip coverage (CRTC) is a software testing coverage criterion that
requires that all possible round trip paths through a program be executed at least once. A
round trip path is a path that starts and ends at the same node.
For example, let's say we have a program with the following code:
Code snippet
if (x > 0) {
y = x + 1;
} else {
y = x - 1;
}
There are two possible round trip paths through this code:
CRTC is a stronger coverage criterion than simple round trip coverage. It can be used to
identify potential problems with the way that a program handles different round trip paths
through the code. However, it is still not a complete coverage criterion, and it may not be
sufficient to find all potential problems in a program.
Complete round trip coverage can be used in conjunction with other coverage criteria, such
as simple round trip coverage and path coverage, to provide a more complete picture of the
testing of a program.
Here are some tips for achieving complete round trip coverage:
● Use a variety of testing techniques. There are many different types of testing
techniques, such as black-box testing, white-box testing, and boundary-value testing.
Using a variety of techniques can help you to find a wider range of errors.
● Test the software under different conditions. The software should be tested under a
variety of conditions, such as different operating systems, different hardware
configurations, and different data sets. Testing the software under different conditions
can help you to find errors that are only triggered by certain conditions.
● Get feedback from users. Once the functional testing is complete, you should get
feedback from users. This feedback can help you to identify any usability issues with
the software.
By following these tips, you can help to ensure that your complete round trip coverage is
effective and that your software is free of errors.
Prime path coverage (PPC) is a software testing coverage criterion that requires that all
prime paths through a program be executed at least once. A prime path is a path that is not
a proper subpath of any other path.
For example, let's say we have a program with the following code:
Code snippet
if (x > 0) {
y = x + 1;
} else {
y = x - 1;
}
The first path is a prime path, but the second path is not a prime path because it is a proper
subpath of the first path.
PPC is a stronger coverage criterion than path coverage. It can be used to identify potential
problems with the way that a program handles different paths through the code. However, it
is still not a complete coverage criterion, and it may not be sufficient to find all potential
problems in a program.
Prime path coverage can be used in conjunction with other coverage criteria, such as
statement coverage and branch coverage, to provide a more complete picture of the testing
of a program.
● Use a variety of testing techniques. There are many different types of testing
techniques, such as black-box testing, white-box testing, and boundary-value testing.
Using a variety of techniques can help you to find a wider range of errors.
● Test the software under different conditions. The software should be tested under a
variety of conditions, such as different operating systems, different hardware
configurations, and different data sets. Testing the software under different conditions
can help you to find errors that are only triggered by certain conditions.
● Get feedback from users. Once the functional testing is complete, you should get
feedback from users. This feedback can help you to identify any usability issues with
the software.
By following these tips, you can help to ensure that your prime path coverage is effective
and that your software is free of errors.
A definition-use pair (DU pair) is a pair of nodes in a data flow graph (DFG) that
represents the flow of data from a definition of a variable to a use of that variable. The
definition node is the node where the variable is assigned a value, and the use node is the
node where the variable's value is read.
A DU path is a path in a DFG that connects a definition node to a use node. A DU path is
said to be "definition-clear" if there are no intervening definitions of the variable along the
path.
Code snippet
START
x=1
y=x+1
PRINT y
RETURN
The DFG for this function has 5 nodes and 4 edges. The definition nodes are x = 1 and y
= x + 1, and the use nodes are y = x + 1 and PRINT y. There are two DU paths in this
DFG:
DU pairs and DU paths are important concepts in data flow analysis, which is a technique
used to identify potential errors in software. By analyzing the DU pairs and DU paths in a
DFG, it is possible to identify potential errors such as:
Node coverage (also known as vertex coverage) is a software testing coverage criterion that
focuses on the nodes (or vertices) in a graph. It requires that all of the nodes in the graph be
covered by at least one test case.
For example, let's say we have a graph with the following nodes:
Code snippet
A
B
C
D
E
Node coverage would require that we create at least one test case that visits each of these
nodes. For example, we could create a test case that starts at node A, goes to node B, then
goes to node C, and so on.
Node coverage is a relatively simple coverage criterion to understand and apply. It can be
used to identify potential problems with the way that a program handles different paths
through a graph. However, it is not a complete coverage criterion, and it may not be
sufficient to find all potential problems in a program.
● It is not a complete coverage criterion, and it may not be sufficient to find all potential
problems in a program.
● It can be time-consuming to create test cases that cover all of the nodes in a large
graph.
Node coverage can be used in conjunction with other coverage criteria, such as path
coverage, to provide a more complete picture of the testing of a program.