You are on page 1of 10

(Panniwala mota, Sirsa)

ASSIGNMENT -1
in

SOFTWARE TESTING

TOPICS :-
 Boundary value analysis
 Equivalence class testing
 Control flow testing

Submitted to:- Submitted by:-


Seema Yodha Aishwarya Jaiswal

(Assistant professor in cse dept.) Roll no. 1611151002

C.S.E 8 th sem
BOUNDARY VALUE ANALYSIS-

 This is a simple but popular functional testing technique. Here, we


concentrate on input values and design test cases with input values that are
on or close to boundary values
 Boundary Value Analysis testing is the process of testing between extreme
ends or boundaries between partitions of the input values.
 So these extreme ends like Start- End, Lower- Upper, Maximum-Minimum,
Just Inside-Just Outside values are called boundary values and the testing is
called "boundary testing".
 The basic idea in boundary value testing is to select input variable values at
their:

1. Minimum
2. Just above the minimum
3. A nominal value
4. Just below the maximum
5. Maximum

 In Boundary Testing, Equivalence Class Partitioning plays a good role


 Boundary Testing comes after the Equivalence Class Partitioning.

‘Boundary Value Analysis' Testing technique is used to identify errors at


boundaries rather than finding those that exist in the center of the input domain.

Boundary Value Analysis is the next part of Equivalence Partitioning for designing
test cases where test cases are selected at the edges of the equivalence classes.
imagine, there is a function that accepts a number between 18 to 30, where 18 is
the minimum and 30 is the maximum value of valid partition, the other values of
this partition are 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 and 29.

Example -1

The invalid partition consists of the numbers which are less than 18 such as 12,
14, 15, 16 and 17, and more than 30 such as 31, 32, 34, 36 and 40. Tester develops
test cases for both valid and invalid partitions to capture the behavior of the system
on different input conditions.
Example 2:

Consider a program for the determination of division of a student based on the


marks in three subjects. Its input is a triple of positive integers (say mark1, mark2,
and mark3)
and values are from interval [0, 100].
The division is calculated according to the following rules:
Marks Obtained Division

75 – 100 First Division with distinction


60 – 74 First division
50 – 59 Second division
40 – 49 Third division
0 – 39 Fail

Total marks obtained are the average of marks obtained in the three subjects i.e.
Average = (mark1 + mark 2 + mark3) / 3
The program output may have one of the following words:
[Fail, Third Division, Second Division, First Division, First Division with
Distinction]
Design the boundary value test cases.

Solution: The boundary value test cases are given in Table .


Table . Boundary value test cases for the program determining the division of a
student
Test cases marks1 marks 2 marks 3 expected output

1 0 50 50 Fail
2. 1 50 50 Fail
3. 50 50 50 Second Division
4. 99 50 50 First Division
5. 100 50 50 First Division
6 50 0 50 Fail

7. 50 1 50 Fail

8. 50 99 50 First Division

9. 50 100 50 First Division

10. 50 50 0 Fail
11. 50 50 1 Fail

12. 50 50 99 First Division

13. 50 50 100 First Division

Example -2

INPUT BOX SHOULD ACCEPT THE NUMBER 1 TO 10


Here we will see the Boundary Value Test Cases
Test Scenario Description Expected Outcome 6

Boundary Value = 0 System should NOT accept


Boundary Value = 1 System should accept
Boundary Value = 2 System should accept
Boundary Value = 9 System should accept
Boundary Value = 10 System should accept
Boundary Value = 11 System should NOT accept
EQUIVALENCE CLASS PARTITIONING

 Equivalent Class Partitioning is a black box technique (code is not visible to


tester) which can be applied to all levels of testing like unit, integration,
system, etc.
 In this technique, you divide the set of test condition into a partition that can
be considered the same.
 It divides the input data of software into different equivalence data classes.
 You can apply this technique, where there is a range in the input field.
 In this method, the input domain data is divided into different equivalence
data classes. This method is typically used to reduce the total number of test
cases to a finite set of testable test cases, still covering maximum
requirements.
 In short, it is the process of taking all possible test cases and placing them
into classes. One test value is picked from each class while testing.

 Equivalence partitioning is a technique of software testing in which input


data is divided into partitions of valid and invalid values, and it is mandatory
that all partitions must exhibit the same behavior

 . If a condition of one partition is true, then the condition of another equal


partition must also be true, and if a condition of one partition is false, then
the condition of another equal partition must also be false.

 The principle of equivalence partitioning is, test cases should be designed to


cover each partition at least once. Each value of every equal partition must
exhibit the same behavior as other.

For example-1

assume that there is a function of a software application that accepts a particular


number of digits, not greater and less than that particular number.
For example, an OTP number which contains only six digits, less or more than six
digits will not be accepted, and the application will redirect the user to the error
page.

. OTP Number = 6 digits   

Example-2

Assume, we have to test a field which accepts Age 18 – 56

Valid Input: 18 – 56
Invalid Input: less than or equal to 17 (<=17), greater than or equal to 57 (>=57)

Valid Class: 18 – 56 = Pick any one input test data from 18 – 56

Invalid Class 1: <=17 = Pick any one input test data less than or equal to 17
Invalid Class 2: >=57 = Pick any one input test data greater than or equal to 57

We have one valid and two invalid conditions here.


CONTROL FLOW TESTING

 Control flow testing is a testing technique that comes under white box
testing. The aim of this technique is to determine the execution order of
statements or instructions of the program through a control structure. The
control structure of a program is used to develop a test case for the program.
 In this technique, a particular part of a large program is selected by the tester
to set the testing path. It is mostly used in unit testing.
 Test cases represented by the control graph of the program.
 In other words Control-flow testing is a structural testing strategy that uses
the program’s control flow as a model.
 The entire structure, design, and code of the software have to be studied for
this type of testing. Often the testing method is used by developers
themselves to test their own code and design as they are very familiar with
the code.
 This method is implemented with the intention to test logic of the code so
that the required results or
 functionalities can be achieved. Its main application is to relate the small
programs and segments of the larger programs.

Control Flow Graph Creation:


From the given source code a control flow graph is created either manually or by
using the software.
 Coverage Target:
A coverage target is defined over the control flow graph that includes nodes,
edges, paths, branches etc.
 Test Case Creation:
Test cases are created using control flow graphs to cover the defined coverage
target.
 Test Case Execution:
After the creation of test cases over coverage target, further test cases are
executed.
 Analysis:
Analyze the result and find out whether the program is error free or has some
defects.
Control Flow Graph:

Control Flow Graph is a graphical representation of control flow or


computation that is done during the execution of the program.
 Control flow graphs are mostly used in static analysis as well as compiler
applications, as they can accurately represent the flow inside of a program
unit.
 Control flow graph was originally developed by Frances E. Allen.

Cyclomatic Complexity:

Cyclomatic Complexity is the quantitative measure of the number of linearly


independent paths in it.
It is a software metric used to describe the complexity of a program. It is
computed using the Control Flow Graph of the program.
M = E - N + 2P

Advantages of Control flow testing:

 It detects almost half of the defects that are determined during the unit
testing.
 It also determines almost one-third of the defects of the whole program.
 It can be performed manually or automated as the control flow graph that is
used can be made by hand or by using software also.

Disadvantages of Control flow testing:

 It is difficult to find missing paths if program and the model are done by
same person.
 Unlikely to find spurious features.

Example:-

public class VoteEligiblityAge{  
   
public static void main(String []args){  
int n=45;  
if(n>=18)  
{  
    System.out.println("You are eligible for voting");  
 }  else           
{  
   System.out.println("You are not eligible for voting");  
 }  
}  
}  

Control flow process


‘’14

You might also like