The Wayback Machine - https://web.archive.org/web/20240828190229/https://www.geeksforgeeks.org/boundary-value-analysis-triangle-problem/
Open In App

Boundary Value Analysis – Triangle Problem

Last Updated : 08 Feb, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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:

  1. The smallest possible triangle: 3 sides of length 1. This test case tests the lower boundary of the input domain.
  2. 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.
  3. An equilateral triangle: 3 sides of equal length. This test case tests the case where all sides are equal.
  4. An isosceles triangle: 2 sides of equal length, the third side is different. This test case tests the case where two sides are equal.
  5. 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

Boundary Value Analysis : Nature of Roots of a Quadratic equation
Consider a problem for the determination of the nature of the roots of a quadratic equation where the inputs are 3 variables (a, b, c) and their values may be from the interval [0, 100]. The output may be one of the following depending on the values of the variables: Not a quadratic equation,Real roots,Imaginary roots,Equal roots Our objective is t
12 min read
Boundary Value Test Cases, Robust Cases and Worst Case Test Cases
Generate boundary Value analysis, robust and worst-case test case for the program to find the median of three numbers. Its input is a triple of positive integers (say x, y, and z) and the minimum value can be 100 and maximum can be 500. Median of three numbers is the middle number when all three numbers are sorted. Example - 10, 40, 20 In this case
3 min read
Analysis principles - Analysis Modelling in Software Engineering
Analysis Model is a technical representation of the system. It acts as a link between the system description and the design model. In Analysis Modelling, information, behavior, and functions of the system are defined and translated into the architecture, component, and interface level design in the design modeling. Table of Content Objectives of An
5 min read
Robustness Analysis - Quadratic Equation Problem
Robustness Testing is the extended version of Boundary value analysis. It is a Black Box software testing technique. It does not examine the internal structure or design of the system. Boundaries are a very good place for errors to occur. If we design software and generate test cases, the value within a specified range has less probability for erro
4 min read
What is Earned Value Analysis (EVA)?
DefenseEarned Value Analysis (EVA) is also called "Budget cost of work performed". It is considered a refinement of the cost-monitoring technique. This analysis was first carried out USA's Department of Defense (DOD). In this analysis, a "value" is assigned to each track or work package based on the expenditure forecast. The value assigned is known
5 min read
How Barrier Analysis can help you?
Barrier Analysis is a preventive method that is used by several organizations to prevent the target from hazards with help of barriers. Here, the target can be a person, object, product, etc. that is needed to be protected, a hazard is any harmful energy source that affects the target in a negative way, and a barrier is a prevention method present
3 min read
Analysis of test data using K-Means Clustering in Python
This article demonstrates an illustration of K-means clustering on a sample random data using open-cv library. Pre-requisites: Numpy, OpenCV, matplot-lib Let's first visualize test data with Multiple Features using matplot-lib tool. # importing required tools import numpy as np from matplotlib import pyplot as plt # creating two test data X = np.ra
2 min read
Structured Analysis and Structured Design (SA/SD)
Structured Analysis and Structured Design (SA/SD) is a diagrammatic notation that is designed to help people understand the system. The basic goal of SA/SD is to improve quality and reduce the risk of system failure. It establishes concrete management specifications and documentation. It focuses on the solidity, pliability, and maintainability of t
8 min read
Introduction To Malware Analysis
Malware is an executable binary that is malicious in nature. Malware's can be used by attackers to perform variety of malicious actions like Spying on the target using Keyloggers or RAT'S, they can also delete your data or encrypt your data for "Ransom". Types of Malware: Malware is designed to perform malicious actions and they have different func
4 min read
Dynamic modelling in object oriented analysis and design
Dynamic Modelling describes those aspect of the system that are concerned with time and sequencing of the operations. It is used to specify and implement the control aspect of the system. Dynamic model is represented graphically with the help of state diagrams. It is also known as state modelling. State model consist of multiple state diagrams, one
3 min read
Types of Static Analysis Methods
Static Analysis of Software : Static analysis involves a set of methods used to analyze software source code or object code determine how the software functions and establish criteria to check its correctness. Static analysis studies the source code without executing it and reveals a wide variety of information such as the structure of the model us
2 min read
Analysis required in Natural Language Generation (NLG) and Understanding (NLU)
Language is the method to share and communicate our understanding and knowledge with one another. Language plays an essential factor when it comes to sharing our knowledge, ideas, and vision. Hence, if we can discover a computational approach of language, we can develop a very sturdy means of communication. We adopt various techniques to completely
11 min read
Activities involved in Software Requirement Analysis
Software requirement means requirement that is needed by software to increase quality of software product. These requirements are generally a type of expectation of user from software product that is important and need to be fulfilled by software. Analysis means to examine something in an organized and specific manner to know complete details about
2 min read
Applications of Pareto Analysis
Prerequisites - Pareto Chart Advantages and Disadvantages of Pareto Chart Pareto Analysis is generally very powerful and essential technique required for solving problems like errors, defects, etc. It is one of the simplest, easiest, and very effective tools that are used in identifying effective and essential solutions to problems. Pareto Analysis
4 min read
Basic Principle of Root Cause Analysis
Root Cause Analysis (RCA) is one of main problem-solving techniques. It basically helps organizations in improving software quality that leads to organizational improvement by reducing number of defects in system. It is a systematic process of identifying major cause (root cause) of problems or defects and a helpful way for resolving them. Eliminat
3 min read
Advantages and Disadvantages of Root Cause Analysis
Root Cause Analysis (RCA), as name suggests, it a process of analyzing main cause of defect within system. It is process of identifying main activity or process that causes occurrence of defects which resulted in an undesired outcome and takes corrective measures. After identifying main cause, find or determine different ways to eliminate or remove
3 min read
Steps to do Root Cause Analysis
Root Cause Analysis (RCA) is basically a step in greater problem-solving exercise. Problems or defects can arise in system even if system is of best quality. Solving defect or problems is not greater issue. But some defects or problems can be experienced in future also. Therefore, it is needed to identify true cause of defect. If root cause of defe
3 min read
Short Note on Barrier Analysis
Root Cause Analysis (RCA) is a systematic approach that is used to identify root cause of problem. Barrier Analysis is one of type of RCA technique that is required for determining and identifying hazardous effects. It is an effective and efficient tool that provides safety to target through barrier. It is safety tool that provides shield to the ta
3 min read
Basic Elements of Barrier Analysis
Prerequisite - Barrier Analysis Whenever a problem arises, then fixing problem is only part of solution. One needs to eliminate or resolve main root cause of particular problem in order for particular problem not to reoccur again. For resolving problem permanently, identification of root cause is important. This analysis of root cause is known as r
3 min read
Steps to Develop Barrier Analysis
Barrier Analysis is process that is used to identify pathways that were not protected, or barriers and controls that were present but effective i.e. do not provide protection. If one wants successful completion of barrier analysis then identification of all pathways should be done i.e. complete and thorough identification of all pathways. Three mai
3 min read
Cost/Benefit Analysis
Cost Benefit analysis is thing that everyone must do so as to think of a powerful or an efficient system. But while thinking out on cost and benefit analysis, we also need to find out factors that really affect benefits and costs of system. In developing cost estimates for a system, we need to consider some of cost elements. Some elements among the
3 min read
Estimation technique- Test Point Analysis
Estimation is a management activity that is often a predecessor to planning. Estimation creates approximate cost and schedule targets for tasks like test execution or automation creation. There are multiple factors affecting the test estimation as mentioned here. In Test estimation, we need to apply known estimation best practices to the testing wo
6 min read
Types of Social Networks Analysis
Social networks are the networks that depict the relations between people in the form of a graph for different kinds of analysis. The graph to store the relationships of people is known as Sociogram. All the graph points and lines are stored in the matrix data structure called Sociomatrix. The relationships indicate of any kind like kinship, friend
3 min read
Risk Based Testing and Failure Mode and Effects Analysis
Risk is the probability of a negative or undesirable outcome or event. Risk is any problem that might occur that would decrease customer, user, stakeholder perception of quality and/or project success. Types of risks:There are 2 types of risks- Product Risk and Quality Risk. Product risk-When the Primary effect of a potential problem is on product
9 min read
Tukey-Kramer Test for Post Hoc Analysis
If in ANOVA test we come to a conclusion that we have to reject our null hypothesis(H0) and then we know that some treatment or factor level means are different and we wish to find them then we proceed to do post hoc analysis with Tukey's test to find which pair is different. This method is a multiple comparison method. About: Used to tell about po
2 min read
Overview of Software Composition Analysis
As we know, there are number of different components are used during development of a software application/product. So, only using different components from different sources is not the case, it needs proper verification and validation to ensure everything is correct in the codebase. Here comes the point Software Composition Analysis which is respo
5 min read
Symbolic Analysis in Compiler Design
Symbolic analysis helps in expressing program expressions as symbolic expressions. During program execution, functional behavior is derived from the algebraic representation of its computations. Generally, during normal program execution, the numeric value of the program is computed but the information on how they are achieved is lost. Thus symboli
5 min read
Introduction to Complex Analysis
Complex analysis is a branch of mathematics that deals with complex numbers, their functions, and their calculus. In simple terms, complex analysis is an extension of the calculus of real numbers to the complex domain. We will extend the notions of continuity, derivatives, and integrals, familiar from calculus to the case of complex functions of a
6 min read
Liveliness Analysis in Compiler Design
Liveliness Analysis consists of a specified technique that is implemented to optimize register space allocation, for a given piece of code and facilitate the procedure for dead-code elimination. As any machine has a limited number of registers to hold a variable or data which is being used or manipulated, there exists a need to balance out the effi
9 min read
Region Based Analysis
Compiler design is inherently a regional practice. In this article, we’ll see how the regions that define a compiler differ from one another and how those differences affect the design process. We’ll also explain why region-based analysis is a useful tool for evaluating compiler performance. Introduction to RegionsThe region is a subgraph with only
6 min read