Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
91 views27 pages

Some Terminologies: Error, Mistake, Bug, Fault and Failure

The document discusses various software testing concepts and terminology: 1. It defines common terms used in software testing such as error, bug, fault, failure, test case, and test suite. A test case outlines the input, expected output, and actual output of a test. A set of test cases form a test suite. 2. It provides examples of how to identify equivalence class test cases for the output and input domains of different programs, such as programs to determine the nature of roots of a quadratic equation, find the previous date, and identify the type of triangle. 3. It discusses methods to calculate cyclomatic complexity, which is a software metric used to determine the number of independent paths in a program

Uploaded by

jagdeep
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views27 pages

Some Terminologies: Error, Mistake, Bug, Fault and Failure

The document discusses various software testing concepts and terminology: 1. It defines common terms used in software testing such as error, bug, fault, failure, test case, and test suite. A test case outlines the input, expected output, and actual output of a test. A set of test cases form a test suite. 2. It provides examples of how to identify equivalence class test cases for the output and input domains of different programs, such as programs to determine the nature of roots of a quadratic equation, find the previous date, and identify the type of triangle. 3. It discusses methods to calculate cyclomatic complexity, which is a software metric used to determine the number of independent paths in a program

Uploaded by

jagdeep
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

Software Testing

Some Terminologies
 Error, Mistake, Bug, Fault and Failure
People make errors. A good synonym is mistake. This may be a syntax
error or misunderstanding of specifications. Sometimes, there are logical
errors.

When developers make mistakes while coding, we call these mistakes


“bugs”.

A fault is the representation of an error, where representation is the mode


of expression, such as narrative text, data flow diagrams, ER diagrams,
source code etc. Defect is a good synonym for fault.

A failure occurs when a fault executes. A particular fault may cause


different failures, depending on how it has been exercised.
Software Testing
 Test, Test Case and Test Suite
Test and Test case terms are used interchangeably. In practice, both are
same and are treated as synonyms. Test case describes an input
description and an expected output description.
Test Case ID
Section-I Section-II
(Before Execution) (After Execution)
Purpose : Execution History:
Pre condition: (If any) Result:
Inputs: If fails, any possible reason (Optional);

Expected Outputs: Any other observation:


Post conditions: Any suggestion:
Written by: Run by:
Date: Date:
Fig. 2: Test case template
The set of test cases is called a test suite. Hence any combination of test
cases may generate a test suite.
Software Testing
Example 8.7
Consider the program for the determination of nature of roots of a quadratic
equation as explained in example 8.1. Identify the equivalence class test
cases for output and input domains.
Software Testing
Solution
Output domain equivalence class test cases can be identified as follows:

O1={<a,b,c>:Not a quadratic equation if a = 0}


O1={<a,b,c>:Real roots if (b2-4ac)>0}
O1={<a,b,c>:Imaginary roots if (b2-4ac)<0}
O1={<a,b,c>:Equal roots if (b2-4ac)=0}`
The number of test cases can be derived form above relations and shown
below:

Test case a b c Expected output


1 0 50 50 Not a quadratic equation
2 1 50 50 Real roots
3 50 50 50 Imaginary roots
4 50 100 50 Equal roots
Software Testing
We may have another set of test cases based on input domain.
I1= {a: a = 0}
I2= {a: a < 0}
I3= {a: 1 ≤ a ≤ 100}
I4= {a: a > 100}
I5= {b: 0 ≤ b ≤ 100}
I6= {b: b < 0}
I7= {b: b > 100}
I8= {c: 0 ≤ c ≤ 100}
I9= {c: c < 0}
I10={c: c > 100}
Software Testing

Test Case a b c Expected output

1 0 50 50 Not a quadratic equation


2 -1 50 50 Invalid input
3 50 50 50 Imaginary Roots
4 101 50 50 invalid input
5 50 50 50 Imaginary Roots
6 50 -1 50 invalid input
7 50 101 50 invalid input
8 50 50 50 Imaginary Roots
9 50 50 -1 invalid input
10 50 50 101 invalid input

Here test cases 5 and 8 are redundant test cases. If we choose any value other
than nominal, we may not have redundant test cases. Hence total test cases are
10+4=14 for this problem.
Software Testing
Example 8.8
Consider the program for determining the previous date in a calendar as
explained in example 8.3. Identify the equivalence class test cases for output
& input domains.
Software Testing
Solution
Output domain equivalence class are:

O1={<D,M,Y>: Previous date if all are valid inputs}


O1={<D,M,Y>: Invalid date if any input makes the date invalid}

Test case M D Y Expected output


1 6 15 1962 14 June, 1962
2 6 31 1962 Invalid date
Software Testing
Inputs domain test cases are :

Test Case M D Y Expected output

1 6 15 1962 14 June, 1962


2 -1 15 1962 Invalid input
3 13 15 1962 invalid input
4 6 15 1962 14 June, 1962
5 6 -1 1962 invalid input
6 6 32 1962 invalid input
7 6 15 1962 14 June, 1962
8 6 15 1899 invalid input (Value out of range)
9 6 15 2026 invalid input (Value out of range)
Software Testing
Example – 8.9

Consider the triangle problem specified in a example 8.3. Identify the


equivalence class test cases for output and input domain.
Software Testing
Solution
Output domain equivalence classes are:

O1={<x,y,z>: Equilateral triangle with sides x,y,z}


O1={<x,y,z>: Isosceles triangle with sides x,y,z}
O1={<x,y,z>: Scalene triangle with sides x,y,z}
O1={<x,y,z>: Not a triangle with sides x,y,z}
The test cases are:

Test case x y z Expected Output

1 50 50 50 Equilateral
2 50 50 99 Isosceles

3 100 99 50 Scalene
4 50 100 50 Not a triangle
Software Testing
Input domain based classes are:

I1={x: x < 1}
I2={x: x > 100}
I3={x: 1 ≤ x ≤ 100}
I4={y: y < 1}
I5={y: y > 100}
I6={y: 1 ≤ y ≤ 100}
I7={z: z < 1}
I8={z: z > 100}
I9={z: 1 ≤ z ≤ 100}
Software Testing
Some inputs domain test cases can be obtained using the relationship amongst x,y
and z.

I10={< x,y,z >: x = y = z}


I11={< x,y,z >: x = y, x ≠ z}
I12={< x,y,z >: x = z, x ≠ y}
I13={< x,y,z >: y = z, x ≠ y}
I14={< x,y,z >: x ≠ y, x ≠ z, y ≠ z}
I15={< x,y,z >: x = y + z}
I16={< x,y,z >: x > y +z}
I17={< x,y,z >: y = x +z}
I18={< x,y,z >: y > x + z}
I19={< x,y,z >: z = x + y}
I20={< x,y,z >: z > x +y}
Software Testing
Test cases derived from input domain are:

Test case x y z Expected Output

1 0 50 50 Invalid input
2 101 50 50 Invalid input

3 50 50 50 Equilateral
4 50 0 50 Invalid input
5 50 101 50 Invalid input
6 50 50 50 Equilateral
7 50 50 0 Invalid input
8 50 50 101 Invalid input
9 50 50 50 Equilateral
10 60 60 60 Equilateral
11 50 50 60 Isosceles

12 50 60 50 Isosceles
13 60 50 50 Isosceles
Software Testing

Test case x y z Expected Output

14 100 99 50 Scalene
15 100 50 50 Not a triangle

16 100 50 25 Not a triangle


17 50 100 50 Not a triangle
18 50 100 25 Not a triangle
19 50 50 100 Not a triangle
20 25 50 100 Not a triangle
Software Testing

Two alternate methods are available for the complexity calculations.

1. Cyclomatic complexity V(G) of a flow graph G is equal to the number of


predicate (decision) nodes plus one.
V(G)=  +1
Where  is the number of predicate nodes contained in the flow graph
G.

2. Cyclomatic complexity is equal to the number of regions of the flow


graph.
Software Testing
Example 8.15
Consider a flow graph given in Fig. 23 and calculate the cyclomatic
complexity by all three methods.

Fig. 23
Software Testing
Solution
Cyclomatic complexity can be calculated by any of the three methods.

1. V(G) = e – n + 2P
= 13 – 10 + 2 = 5

2. V(G) =π+1
=4+1=5

3. V(G) = number of regions


=5

Therefore, complexity value of a flow graph in Fig. 23 is 5.


Software Testing
Example 8.16

Consider the previous date program with DD path graph given in Fig. 17.
Find cyclomatic complexity.
Software Testing

Solution

Number of edges (e) = 65


Number of nodes (n) =49
(i) V(G) = e – n + 2P = 65 – 49 + 2 = 18
(ii) V(G) = π + 1 = 17 + 1 = 18
(iii) V(G) = Number of regions = 18

The cyclomatic complexity is 18.


Software Testing
Example 8.17

Consider the quadratic equation problem given in example 8.13 with its DD
Path graph. Find the cyclomatic complexity:
Software Testing
Solution

Number of nodes (n) = 19


Number of edges (e) = 24
(i) V(G) = e – n + 2P = 24 – 19 + 2 = 7
(ii) V(G) = π + 1 = 6 + 1 = 7
(iii) V(G) = Number of regions = 7

Hence cyclomatic complexity is 7 meaning thereby, seven


independent paths in the DD Path graph.
Software Testing
Example 8.18

Consider the classification of triangle problem given in example 8.14. Find


the cyclomatic complexity.
Software Testing
Solution

Number of edges (e) = 23


Number of nodes (n) =18
(i) V(G) = e – n + 2P = 23 – 18 + 2 = 7
(ii) V(G) = π + 1 = 6 + 1 = 7
(iii) V(G) = Number of regions = 7

The cyclomatic complexity is 7. Hence, there are seven independent


paths as given in example 8.14.
Software Testing
Graph Matrices
A graph matrix is a square matrix with one row and one column for every node in the
graph. The size of the matrix (i.e., the number of rows and columns) is equal to the
number of nodes in the flow graph. Some examples of graphs and associated
matrices are shown in fig. 24.

Fig. 24 (a): Flow graph and graph matrices


Software Testing

Fig. 24 (b): Flow graph and graph matrices


Software Testing

Fig. 24 (c): Flow graph and graph matrices

You might also like