Design test cases for loop testing, Software Engineering

Assignment Help:

Q. Regard as a program that reads a set of Data for 'n' no. of triangles. The program reads three integer values like representing the sides of triangles. The program prints for each triangle whether the triangle is isosceles or equilateral or a simple. Develop logic as well as do the following:

(i) Compute cyclomatic complexity?

(ii) Design test cases for loop testing?

Ans.                 The program logic will be like follows:

Enter three sides of a triangle.

Read a, b and c

If(a

Then is_a_triangle=TRUE

Else is_a_triangle=FALSE;

IF is_a_triangle

Then

If(a=b)XOR(a=c)XOR(b=c) AND NOT ((a=b)AND(a=c))

Then print "Triangle is Isosceles"

If(a=b)AND(b=c)

Then print "Triangle is Equilateral"

If(a<>b)AND (a<>c) AND(b<>c)

Then print "Triangle is scalene"

Else

Print "Not a triangle"

The flow graph of the problem is given as in

the fig:

(i) There are 6 independent paths i.e.

1,2,3,9,14

1,2,4,5,6,8,11,13,14

1,2,3,5,6,8,11,13,14

1,2,4,5,6,7,8,11,13,14

1,2,4,5,6,8,10,11,13,14

1,2,4,5,6,8,11,12,13,14

Cyclomatic complexity is 6

1907_Design test cases for loop testing.png

(ii) Few test cases are:

778_Design test cases for loop testing1.png


Related Discussions:- Design test cases for loop testing

What do you mean by reverse engineering, Q. What do you mean by REVERSE ENG...

Q. What do you mean by REVERSE ENGINEERING? REVERSE ENGINEERING:-It is a process of analyzing software with a outlook to understanding its design and specification. In t

What is the benefit of modular design, What is the benefit of modular desig...

What is the benefit of modular design? Changes made during testing and maintenance becomes manageable and they do not influence other modules.

Explain the throw away prototype, Explain the Throw away prototype I...

Explain the Throw away prototype In this technique, prototype is discarded once its purpose is fulfilled and final system is built from scratch. Prototype is built quickly t

Define external coupling, Q. Define External coupling? External coupli...

Q. Define External coupling? External coupling: A form of coupling in that a module has a dependency to other module external to the software being developed or to a particul

Explain cyclomatic complexity, What is cyclomatic complexity? Cyclomati...

What is cyclomatic complexity? Cyclomatic complexity is given by McCabe. The general formula to compute cyclomatic complexity is M=V (G)=E - N + 2P Where E-Number of e

Define the structural testing, Q. Define the Structural Testing? For a ...

Q. Define the Structural Testing? For a moment it called white-box testing. At this point derivations of test cases are according to the program structure. Knowledge of the pro

Define equivalence partitioning, What is equivalence partitioning? Equi...

What is equivalence partitioning? Equivalence partitioning is a black box method that separates the input domain into classes of data. From this data test cases can be derived.

What is operational testing, Testing conducted to consider a system or comp...

Testing conducted to consider a system or component in its operational environment. Contrast with development, testing,; testing, acceptance;

What is upwardly compatible software, "Upwardly compatible software" is sof...

"Upwardly compatible software" is software that is compatible with a later or more difficult version of itself. For example, an upwardly compatible software is able to occur files

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd