İstanbul evden eve nakliyat Beylikd¨¹z¨¹ evden eve nakliyat Tuzla evden eve nakliyat
Tutorial-14 To read the sides of a Triangle and check its shape and perform complete Path Testing on it
Delicious Bookmark this on Delicious
software testing genius

Tutorial-14 To read the sides of a Triangle and check its shape and perform complete Path Testing on it

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

Tutorial-14: To read the sides of a Triangle and check its shape & perform complete Path Testing on it

Inputs for the Tutorial:
A triangle having three sides a, b and c with their values in the range of 0 to 100 as integers.

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

Objective –1:
To write a Program in C++ for the checking as to whether the triangle is either of : Equilateral Triangle, Isosceles Triangle, Scalene or "Not a Triangle".

Objective –2: To perform Path Testing on the above & derive the following:

1) Flow Graph
2) DD Path Graph
3) Independent Paths
4) Cyclomatic Complexity

color=#000080>

Solution Part – 1: Program in C++

#include
#include
(1) int main ()
(2) {
(3) int a, b, c, validinput = 0;
(4) printf("Enter the side `a' value:")
(5) scanf("%d",&a);
(6) printf("Enter the side `b' value:")
(7) scanf("%d",&b);
(8) printf("Enter the side `c' value:")
(9) scanf(%d", %c);
(10) if((a>0)&&(a<100)&&(b>0)&&(b<=100)&&(c>0)&&(c<=100))
{
(11) if(((a+b)>c)&&((c+a)>b)&&((b+c)>a))
{
(12) validInput=l;
(13) }
(14) }
(15) else
}
(16) validInput=-l;
(17) }
(18) if(validInput==1)
{
(19) if((a==b)&&(b==c))
{
(20) printf("The triangle is EQUILATERAL");
(21) }
(22) else if((a==b)||(b==c)||(c==a))
{
(23) printf("The triangle is ISOSCELES");
(24) }
(25) else
{
(26) printf("The triangle is SCALENE");
(27) }
(28) }
(29) elseif(validInput==0)
{
(30) printf("The values do not constitute a triangle");
(31) }
(32) else
{
(33) printf("The inputs belong to invalid range");
(34) }
(35) getche();
(36) return 1;
(37) }

Solution Part – 2:

A) Mapping Table for DD path Graph

Flow Graph Nodes

DD Path Graph Corresponding Nodes

Remarks

1 to 9

A

Sequential Nodes

10

B

Decision Nodes

11

C

Decision Nodes

12,13

D

Sequential Nodes

14

E

Two edges are joined here

15,16,17

F

Sequential Nodes

18

G

Decision nodes plus joining of two edges

19

H

Decision Nodes

20,21

I

Sequential Nodes

22

J

Decision Nodes

23,24

K

Sequential Nodes

25,26,27

L

Sequential Nodes

28

M

Three edges combined here

29

N

Decision Nodes

30,31

O

Sequential Nodes

32,33,34

P

Sequential Nodes

35

Q

Three edges combined here

36,37

R

Sequential nodes with exit node


B) Independent Paths

1) ABFGNPQR
2) ABFGNOQR
3) ABCEGNPQR
4) ABCDGIMOQR
5) ABFGHIMQR
6) ABFGHJKMQR
7) ABFGHJLMQR

C) Cyclomatic Complexity

The Cyclomatic Complexity or the Structural Complexity of the above code can be found by using the formulae

V(G) = e - n + 2P

where V(G) is the cyclomatic metric of Graph 'G' with 'n' vertices, 'e' edges and 'P' connected components.

In this case, the value of e = 23, n = 18 and P = 1.

Therefore, the value of V (G) comes out to be 7

Two sample Screenshot with different output are as under:

Screenshot – 1: For an Equilateral Triangle


Screenshot – 2: For an Isosceles Triangle



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