Articles

Design the test cases and test the program of Triangle problem by using Boundary Value Analysis

Share

A polygon having three sides is said to be a triangle if each and every side is smaller than the sum of other two sides. Based on sides, A triangle can be classified into three categories scalene, equilateral and isosceles triangle.

An isosceles triangle is a triangle in which its two sides are equal.

An equilateral triangle is a triangle in which all three sides are equal.

A scalene triangle is a triangle in which no sides are equivalent to one other.

We are supposing interval [1,10] for test cases and will generate test cases using Boundary value analysis accordingly. Expected Output can be [ Scalene Triangle, Not a Triangle, Equilateral triangle, Isosceles Triangle ]

Program:

#include<conio.h>
#include<stdio.h>
void main()
{
  int a,b,c,result;
  printf(" Enter the values of a, b and c : = ");
  scanf("%d %d %d", &a,&b,&c);
    if(((a+b)>c)&&((b+c)>a)&&((c+a)>b))
    {
      
      if((a==b)&&(b==c))
          printf("\n It is an Equilatral Triangle");
    else if((a==b)||(b==c)||(c==a))
        printf("\n It is an isosceles Triangle");
          else
              printf("\n It is a Scalene Triangle");
      
    }
    else
    printf("\n not a triangle");
    
  

  getch();
}

In Boundary Value Analysis, 4N+1  test case will be generated, which means, in this case, 4*3+1 = 13 test cases.

Test IDabcExpected OutputProgram OutputTested Outcome
1155IsoscelesIsoscelesPass
2255IsoscelesIsoscelesPass
3955IsoscelesIsoscelesPass
41055Not a TriangleNot a TrianglePass
5515IsoscelesIsoscelesPass
6525IsoscelesIsoscelesPass
7595IsoscelesIsoscelesPass
85105Not a TriangleNot a TrianglePass
9551IsoscelesIsoscelesPass
10552IsoscelesIsoscelesPass
11559IsoscelesIsoscelesPass
125510Not a TriangleNot a TrianglePass
13555EquilateralEquilateralPass

Testing Result of the Program

Not a Triangle

Equilateral triangle

Isosceles Triangle

Sandeep Verma

Published by
Sandeep Verma
Tags: software testing st triangle problem