İstanbul evden eve nakliyat Beylikd¨¹z¨¹ evden eve nakliyat Tuzla evden eve nakliyat
Tutorial-10 To Find out the area of a Triangle-Square-Rectangle and a Circle and generate its Equivalence Class Test Cases
Delicious Bookmark this on Delicious
software testing genius

Tutorial-10 To Find out the area of a Triangle-Square-Rectangle and a Circle and generate its Equivalence Class Test Cases

Welcome to “Software Testing Genius”. Subscribe to my RSS feed for latest content on Software Testing.

Tutorial-10: To Find out the area of a Triangle, Square, Rectangle and a Circle and generate its Equivalence Class Test Cases

Objective of this Tutorial:
There are two objectives of the tutorial like:

Objective –1:
To write programs in C++ for the determining the areas of a Triangle, Square, Rectangle & a circle.

Objective –2: Equivalence Class Testing by designing Test Cases for all i.e. Triangle, Square, Rectangle & circle

Solution Part – 1: Program in C++

size=2>

#include

#include

#include

void main()

{

clrscr();

int ch;

char c;

float, b, h, a;

1: cout<<"Enter your choice";

cout<<"n1.Triangle";

cout<<"n2.Square";

cout<<"n3.Rectangle";

cout<<"n4.Circle";

cout<<"n5.Exitn";

cin>>ch;

switch(ch)

{ case 1 : b: cout<<"nEnter the base of the triangle (1-200)";

cin>>b;

if ((b<=0)||(b>200))

{ cout<<"nInvalid entry for base n";

goto b;

}

h: cout<<"nEnter the height of the triangle (1-200)";

cin>>h;

if ((h<=0)||(h>200))

{ cout<<"nInvalid height nEnter the height (1-200)";

goto h;

}

a= 0.5*b*h;

cout<<"nThe area is "<

cout<<"nWant to enter more?(y/n) ";

cin>>c;

if((c=='y')||(c=='Y'))

goto 1;

break

case 2 : s: cout<<"nEnter the side of the square (1-200)";

cin>>b;

if ((b<=0)||(b>200))

{ cout<<"nInvalid entry for base n";

goto s;

}

a= b*b;

cout<<"nThe area is "<

cout<<"nWant to enter more?(y/n) ";

cin>>c;

if((c=='y')||(c=='Y'))

goto 1;

break;

case 3: d: cout<<"nEnter the base of the triangle (1-200)" ;

cin>>b;

if((b<=0)||(b>200))

( cout<<"nInvalid entry for base n";

goto d;

}

p: cout<<"nEnter the height of the triangle (1-200) ";

cin>>h;

if ((h<=0)||(h>200))

{ cout<<"nInvalid height nEnter the height(1-200)";

goto p;

}

a=b*h;

cout<<"nThe area is "<

cout<<"nWant to enter more?(y/n) ";

cin>>c;

if((c=='y')||(c=='Y'))

goto 1;

break;


case 4: t: cout<<"nEnter the radius of the circle ";

cin>>b;

if ((b<=0)||(b>200))

{ cout<<"nInvalid entry for base n";

goto t;

}

a= 3.14*b*b;

cout<<"nThe area is "<

cout<<"nWant to enter more?(y/n)";

cin>>c;

if ((c=='y')||(c=='Y'))

goto 1;

break;

case 5: exit(0);

break;

default : cout<<"n WRONG CHOICE";

goto 1;

}

getch();

}


Solution Part – 2: Equivalence Class Test Cases

In Equivalence Class Testing, we find two types of equivalence classes 1) Input Domain and 2) Output Domain.

Input Domain is formed from one valid sequence and two invalid sequences. The Output Domain is obtained from different types of outputs of the problem.

Case – 1: Triangle

Input Domain:

I1 = {h : h<=0}

I2 = {h : h>200}

I3 = {h : 1<=h<=200}

I4 = {b : b<=0}

I5 = {b : b>200}

I6 = {b : 1<=b<=2001}

Test Cases for the Case of Triangle are as under:

Test Case ID

h

b

Expected Output

1

0

100

Invalid Input

2

100

100

5000

3

201

100

Invalid Input

4

100

0

Invalid Input

5

100

100

5000

6

100

201

Invalid Input

Output Domain:

O1 = {: Triangle if h > 0, b > 0}

O2 = {: Not a triangle if h <= 0, b <= 0}


Screenshot of output with Inputs of Triangle is as under:


Case – 2: Square

Input Domain:

I1 = {s : s<=0}

I2 = {s : s>200}

I3 = {s : 1<=s<=200}

Test Cases for the Case of Square are as under:

Test Case ID

s

Expected Output

1

0

Invalid Input

2

100

10000

3

201

Invalid Input

Output Domain:

O1 = {: Square if s>}

O2 = {: Not a square if s <= 0}


Screenshot of output with Inputs of Square is as under:


Case – 3: Rectangle

Input Domain:

I1 = {l : l<=0}

I2 = {l : l>200}

I3 = {l : 1<=l<=200}

I4 = {b : b<=0}

I5 = {b : b>200}

I6 = {b : 1<=b<=200}

Test Cases for the Case of Rectangle are as under:

Test Case ID

l

b

Expected Output

1

0

100

Invalid Input

2

100

100

10000

3

201

100

Invalid Input

4

100

0

Invalid Input

5

100

100

10000

6

100

201

Invalid Input


Screenshot of output with Inputs of Rectangle is as under:


Case – 4: Circle

Input Domain:

I1 = {r : r<=0}

I2 = {r : r>200}

I3 = {r : 1<=r<=200}

Test Cases for the Case of Circle are as under:

Test Case ID

r

Expected Output

1

0

Invalid Input

2

100

31400

3

201

Invalid Input

Output Domain:

O1 = {: Circle if 1<=r<=200}

O2 = {: Not a Circle if r <= 0}


Screenshot of output with Inputs of Circle is as under:



Many More Articles & Tutorials on Black Box Testing 

Largest Database of Sample Papers - 1000+ Unique Questions for ISTQB Foundation Exam

ISTQB Foundation Exam - Full Crash Course for Download

ISTQB Advanced CTAL Test Analysts Exam - Full Crash Course for Download


ISTQB Advanced CTAL Test Manager Exam - Full Crash Course for Download


What Successful Testers say about the Quality of this website

If you want to keep track of further articles on Software Testing,
I suggest you to subscribe my
RSS feed
.

You can also Subscribe by E-mail
and get All New articles delivered directly to your Inbox.

Get your Absolutely Free Copy of Several MS PowerPoint Presentations & E-Books related to ISTQB, HP Load Runner, IBM RFT, HP QTP & QC Certification Exams, prepared by Popular Writers & Trainers, by writing to: Software.testing.genius@gmail.com

Full Study Material for Popular Certification Exams:

Study Material - HP QTP & QC Certification Exam

Study Material - IBM RFT Certification Exam

Study Material - HP LoadRunner Certification Exams for All Modules

Study Material - ISTQB Certification Exam

Most Popular Topics in Demand:

Practical Roadmap to QTP Certification

Practical Roadmap to CSTE Certification

Consolidated Study Material - Testing & QA

Rehearsal of QTP in 1 Hr. -  Interview Questions

 

Comments :

comments ↓


Leave Your Comments: (*) Marked Fields are Mandatory

You can apply basic formatting to the text

Name *
 
Email Address *
 
Website
 
Speak your mind
characters
sex hikayeleri