Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

software testing

What is boundary testing?

Kainat Asif

Boundary testing is a type of black-box testing that tests the boundary values between partitions of input values.

Why do we need boundary testing?

Consider the code snippet below:

int arr[100];
for(int i=0; i<=100; i++){
   arr[i] = i;
}

The code above works well for input i= 0 to 99 but gives an error for only i=100. This is because the array arr is of size 100 and has a valid index from 0 to 99. The for loop iterates for i = 0 to 100. When i = 100, the program crashes, as the array index is out of bounds. Boundary testing is used to identify errors that are near the boundary of partitions of input values.

Examples

Example 1

Consider an ordering system in which the minimum number of items that can be ordered is 1 and the maximum number of items that can be ordered is 5. The input value partitions for the system will be as follows:

Boundary values

  • Valid boundary values: 1, 2, 4, 5
  • Invalid boundary values: 0, 6

Test cases

The test cases of the example above will be as follows:

  • Test case 1: Number of items ordered = less than 1
  • Test case 2: Number of items ordered = 1
  • Test case 3: Number of items ordered = value between 2 - 4
  • Test case 4: Number of items ordered = 5
  • Test case 5: Number of items ordered = greater than 5

Example 2

Consider an example of a grading system as shown below:

Marks obtained

Grade

0 - 50

F

51 - 70

C

71 - 90

B

91 - 100

A

Boundary values

  • Valid boundary values: 0, 1, 49, 50, 51, 52, 69, 70, 71, 72, 89, 90, 91, 92, 99, 100
  • Invalid boundary values: -1, 101

Test cases

The test cases of the example above will be as follows:

  • Test case 1: Marks obtained = less than 0
  • Test case 2: Marks obtained = 0
  • Test case 3: Marks obtained = value between 1 - 49
  • Test case 4: Marks obtained = 50
  • Test case 5: Marks obtained = 51
  • Test case 6: Marks obtained = value between 52 - 69
  • Test case 7: Marks obtained = 70
  • Test case 8: Marks obtained = 71
  • Test case 9: Marks obtained = value between 72 - 89
  • Test case 10: Marks obtained = 90
  • Test case 11: Marks obtained = 91
  • Test case 12: Marks obtained = value between 92 - 99
  • Test case 13: Marks obtained = 100
  • Test case 14: Marks obtained = greater than 100

RELATED TAGS

software testing

CONTRIBUTOR

Kainat Asif
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring