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

Segment 6 (Part 2)

Uploaded by

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

Segment 6 (Part 2)

Uploaded by

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

Graph Matrices

A graph matrix is a data structure that can assist in developing a software tool for
automation of basis path testing. A graph matrix is a square matrix whose size (i.e.,
number of rows and columns) is equal to the number of nodes on the flow graph. Each
row and column corresponds to an identical node, and matrix entries corresponds to
connections (an edge) between nodes. Conventionally, nodes are denoted by digits and
edges are denoted by letters.

Let’s take an example.

Let’s convert this control flow graph into a graph matrix. Since the graph has 4 nodes, so
the graph matrix would have a dimension of 4 X 4. Matrix entries will be filled as
follows:

 (1, 1) will be filled with ‘a’ as an edge exists from node 1 to node 1
 (1, 2) will be filled with ‘b’ as an edge exists from node 1 to node 2. It is
important to note that (2, 1) will not be filled as the edge is unidirectional and
not bidirectional
 (1, 3) will be filled with ‘c’ as edge c exists from node 1 to node 3
 (2, 4) will be filled with ‘d’ as edge exists from node 2 to node 4
 (3, 4) will be filled with ‘e’ as an edge exists from node 3 to node 4
The graph matrix formed is shown below :

Connection Matrix

A connection matrix is a matrix defined with edges weight. In simple form, when a
connection exists between two nodes of control flow graph, then the edge weight is 1,
otherwise, it is 0. However, 0 is not usually entered in the matrix cells to reduce the
complexity.

For example, if we represent the above control flow graph as a connection matrix, then
the result would be:
As we can see, the weight of the edges are simply replaced by 1 and the cells which were
empty before are left as it is, i.e., representing 0.

A connection matrix is used to find the cyclomatic complexity of the control graph.
Although there are three other methods to find the cyclomatic complexity but this
method works well too.

Following are the steps to compute the cyclomatic complexity :

1. Count the number of 1s in each row and write it in the end of the row
2. Subtract 1 from this count for each row (Ignore the row if its count is 0)
3. Add the count of each row calculated previously
4. Add 1 to this total count
5. The final sum in Step 4 is the cyclomatic complexity of the control flow graph

Let’s apply these steps to the graph above to compute the cyclomatic complexity.

We can verify this value for cyclomatic complexity using other methods also.
Equivalence partitioning and Boundary value Analysis

Practically, due to time and budget considerations, it is not possible to perform


exhausting testing for each set of test data, especially when there is a large pool of input
combinations.

 We need an easy way or special techniques that can select test cases intelligently
from the pool of test-case, such that all test scenarios are covered.
 We use two techniques - Equivalence Partitioning & Boundary Value Analysis
testing techniques to achieve this.

Equivalence Partitioning

Equivalence Partitioning or Equivalence Class Partitioning is type of black box testing


technique which can be applied to all levels of software testing like unit, integration,
system, etc. In this technique, input data units or input domains are divided into classes
or groups of data. These classes are known as equivalence classes and the process of
making equivalence classes is called equivalence partitioning that can be used to derive
test cases which reduces time required for testing because of small number of test
cases. Equivalence classes represent a set of valid or invalid states for input condition.
An input condition can be a range, a specific value, a set of values, or a Boolean value.
Then depending upon type of input, equivalence classes is defined.

Example:

 Let's consider the behaviour of Order Pizza Text Box Below.


 Pizza values 1 to 10 is considered valid. A success message is shown.
 While value 11 to 99 are considered invalid for order and an error message will
appear, "Only 10 Pizza can be ordered".

Order Pizza: SUBMIT

Here is the test condition

 Any Number greater than 10 entered in the Order Pizza field (let say 11) is
considered invalid.
 Any Number less than 1 that is 0 or below, then it is considered invalid.
 Numbers 1 to 10 are considered valid.
 Any 3 Digit Number say -100 is invalid.
We cannot test all the possible values because if done, the number of test cases will be
more than 100. To address this problem, we use equivalence partitioning hypothesis
where we divide the possible values of tickets into groups or sets as shown below
where the system behaviour can be considered the same.

The divided sets are called Equivalence Partitions or Equivalence Classes. Then we pick
only one value from each partition for testing. The hypothesis behind this technique
is that if one condition/value in a partition passes all others will also pass.
Likewise, if one condition in a partition fails, all other conditions in that partition
will fail.
Boundary value Analysis

In Boundary Value Analysis, you test boundaries between equivalence partitions.

In our earlier equivalence partitioning example, instead of checking one value for each
partition, you will check the values at the partitions like 0, 1, 10, 11 and so on. As you
may observe, you test values at both valid and invalid boundaries. Boundary Value
Analysis is also called range checking.

Equivalence partitioning and boundary value analysis (BVA) are closely related and can
be used together at all levels of testing.

Why Equivalence & Boundary Analysis Testing

 This testing is used to reduce a very large number of test cases to manageable
chunks.
 Very clear guidelines on determining test cases without compromising on the
effectiveness of testing.
 Appropriate for calculation-intensive applications with a large number of
variables/inputs.

Equivalence partitioning and Boundary value Analysis (Summary)

 Both are used when practically it is impossible to test a large pool of test cases
individually.
 In Equivalence Partitioning, first, you divide a set of test condition into a
partition that can be considered.
 In Boundary Value Analysis you then test boundaries between equivalence
partitions.

You might also like