Boundary Value Analysis - Triangle Problem
Last Updated :
08 Feb, 2023
The triangle problem is a classic example of using boundary value analysis to test a software program. The problem involves determining if three values, representing the lengths of the sides of a triangle, form a valid triangle.
To perform boundary value analysis, we start by selecting test cases that include values at the boundaries of the input domain. In the case of the triangle problem, the input domain is defined by the length of each side, which can be any positive number.
The following are some example test cases for the triangle problem using boundary value analysis:
- The smallest possible triangle: 3 sides of length 1. This test case tests the lower boundary of the input domain.
- A degenerate triangle: 3 sides of length 0. This test case tests the case where the input values are at the lower boundary and are not valid.
- An equilateral triangle: 3 sides of equal length. This test case tests the case where all sides are equal.
- An isosceles triangle: 2 sides of equal length, the third side is different. This test case tests the case where two sides are equal.
- A scalene triangle: 3 sides of different length. This test case tests the case where all sides are different.
By testing these boundary values, we can ensure that the software program correctly handles the edge cases of the input domain and produces correct results for all possible inputs.
Boundary Value Analysis (BVA) is a black box software testing technique where test cases are designed using boundary values. BVA is based on the single fault assumption, also known as critical fault assumption which states that failures are rarely the product of two or more simultaneous faults. Hence while designing the test cases for BVA we keep all but one variable to the nominal value and allowing the remaining variable to take the extreme value.
Test Case Design for BVA: While designing the test cases for BVA first we determine the number of input variables in the problem. For each input variable, we then determine the range of values it can take. Then we determine the extreme values and nominal value for each input variable.
Consider an input variable t taking values in the range [l, r].Extreme values for t are -

t = l
t = l+1
t = r-1
t = r
The nominal value for the variable can be any value in the range (l, r).
In most of the BVA implementations, it is taken as the middle value of the range (r+l)/2.
The figure on the right shows the nominal and extreme values for boundary value of analysis of a two variable problem.
Under the single fault assumption, the total number of test cases in BVA for a problem with n inputs is 4n+1.
The 4n cases correspond to the test cases with the four extreme values of each variable keeping the other n-1 variable at nominal value. The one additional case is where all variables are held at a nominal value.
One of the common problem for Test Case Design using BVA is the Triangle Problem that is discussed below -
Triangle Problem accepts three integers - a, b, c as three sides of the triangle .We also define a range for the sides of the triangle as [l, r] where l>0. It returns the type of triangle (Scalene, Isosceles, Equilateral, Not a Triangle) formed by a, b, c.
For a, b, c to form a triangle the following conditions should be satisfied -
a < b+c
b < a+c
c < a+b
If any of these conditions is violated output is Not a Triangle.
- For Equilateral Triangle all the sides are equal.
- For Isosceles Triangle exactly one pair of sides is equal.
- For Scalene Triangle all the sides are different.
The table shows the Test Cases Design for the Triangle Problem.The range value [l, r] is taken as [1, 100] and nominal value is taken as 50.
The total test cases is,
4n+1 = 4*3+1 = 13
Test Case ID | a | b | c | Expected Output |
---|
T1 | 1 | 50 | 50 | Isosceles |
T2 | 2 | 50 | 50 | Isosceles |
T3 | 99 | 50 | 50 | Isosceles |
T4 | 100 | 50 | 50 | Not a Triangle |
T5 | 50 | 50 | 50 | Equilateral |
T6 | 50 | 1 | 50 | Isosceles |
T7 | 50 | 2 | 50 | Isosceles |
T8 | 50 | 99 | 50 | Isosceles |
T9 | 50 | 100 | 50 | Not a Triangle |
T10 | 50 | 50 | 1 | Isosceles |
T11 | 50 | 50 | 2 | Isosceles |
T12 | 50 | 50 | 99 | Isosceles |
T13 | 50 | 50 | 100 | Not a Triangle |
Similar Reads
Angle Sum Property of a Triangle
Angle Sum Property of a Triangle is the special property of a triangle that is used to find the value of an unknown angle in the triangle. It is the most widely used property of a triangle and according to this property, "Sum of All the Angles of a Triangle is equal to 180º." Angle Sum Property of a
8 min read
Find Perimeter of a triangle
Given side (a, b, c) of a triangle, we have to find the perimeter of a triangle. Perimeter : Perimeter of a triangle is the sum of the length of side of a triangle. where a, b, c are length of side of a triangle.Perimeter of a triangle can simply be evaluated using following formula : perimeter = (a
3 min read
Congruence of Triangles |SSS, SAS, ASA, and RHS Rules
Congruence of triangles is a concept in geometry which is used to compare different shapes. It is the condition between two triangles in which all three corresponding sides and corresponding angles are equal. Two triangles are said to be congruent if and only if they can be overlapped with each othe
9 min read
Class 9 NCERT Solutions- Chapter 7 Triangles - Exercise 7.1
Chapter 7 of the Class 9 NCERT Mathematics textbook focuses on Triangles a fundamental concept in geometry. This chapter explores various properties and theorems related to the triangles such as the congruence, similarity, and various criteria for proving the triangles congruent. Exercise 7.1 is an
8 min read
Area of largest triangle that can be inscribed within a rectangle
Given a rectangle of length L     and breadth B     . The task is to find the area of the biggest triangle that can be inscribed in it.Examples:  Input: L = 5, B = 4Output: 10Input: L = 3, B = 2Output: 3  From the figure, it is clear that the largest triangle that can be inscribed in the rectangle,
4 min read
Class 10 RD Sharma Solutions - Chapter 4 Triangles - Exercise 4.1
Question 1. (Fill in the blanks using the correct word given in brackets: (i) All circles are _____________ (congruent, similar).(ii) All squares are _____________ (similar, congruent).(iii) All _____________ triangles are similar (isosceles, equilaterals) :(iv) Two triangles are similar, if their c
2 min read
Class 9 RD Sharma Solutions - Chapter 10 Congruent Triangles- Exercise 10.1
In Class 9 Mathematics, Chapter 10 of "RD Sharma" focuses on the Congruent Triangles, it is a fundamental concept in geometry. This chapter introduces students to the criteria for triangle congruence and provides a variety of problems to practice these concepts. Exercise 10.1 specifically deals with
10 min read
Class 10 NCERT Solutions- Chapter 6 Triangles - Exercise 6.2
NCERT Solutions for Class 10 Maths Chapter 6 - Triangles (Exercise 6.2)In this article, we provide detailed solutions to the questions in Exercise 6.2 of Chapter 6: Triangles from the NCERT Class 10 Mathematics textbook. The chapter focuses on various theorems related to triangles, including the Bas
7 min read
Class 10 NCERT Solutions- Chapter 6 Triangles - Exercise 6.1
The Triangles are fundamental geometric shapes studied in Class 10 Mathematics. They are crucial for understanding the properties and relationships between the angles, sides, and overall structure of the shapes in Euclidean geometry. Exercise 6.1 in Chapter 6 of the NCERT textbook delves into the pr
2 min read
Class 9 NCERT Solutions - Chapter 9 Areas of Parallelograms And Triangles - Exercise 9.2
Chapter 9 of the Class 9 NCERT Mathematics textbook focuses on the concept of areas of parallelograms and triangles. Understanding how to calculate these areas is crucial for solving various geometric problems. Exercise 9.2 provides the practice problems to apply the formulas and concepts learned in
7 min read