You are on page 1of 36

PRACTICAL FILE

OF
Software Testing & Quality Management
(SOFTWARE LAB- XIII)

JANUARY – JUNE 2020

SUBMITTED TO: SUBMITTED BY:


PROF. SATINDERJEET SINGH SHWETA
ROLL NO: – 1811686

DEPARTMENT OF COMPUTER APPLICATIONS


GUJRANWALA GURU NANAK INSTITUTE OF MANAGEMENT
&TECHNOLOGY
Civil Lines, Ludhiana

1
INDEX
Sr. No. Particulars Page No.
1)
1. Software Engineering Virtual Lab 3-4

2)
2. Enter the three numbers and find the middle value 5-7
of three numbers
3.3) Enter the Number and find the Factorial of a 8-10
number.
4.4) Enter the year and check if it is a leap year or not. 11-13
5. Enter the sides and get the area of Rhombus. 14-16
6. Code for enter the character (vowels only) and 17-19
find its ASCII value
7. Enter the number and check if the given number 20-22
is prime or not
8. Enter the Sides and get the Triangle Type. 23-25
9. Write a code for enter the P.R.T and calculate the 26-27
simple interest.
10.
5) Enter the P,R,T and calculate the Compound 28-30
Interest
11. Enter the sides and get the Area of Triangle 31-33
12. Enter three numbers and find the greatest of three 34-36
numbers.

Signature

2
SOFTWARE ENGINEERING VIRTUAL LAB
Introduction
Research analysis manifests clear trends of growing interest of the Computer
Science students towards e-learning. To keep this trend as well as the pace with
the rapid advancement of software technologies, the "Software Engineering
Virtual Lab" has been developed. This lab attempts to provide basic concepts
to the students on a wide range of topics including Requirements analysis, ER
modeling, identification of domain classes, use-case diagrams and designing a
test suite. Ample illustrations and simulations are used to reinforce one's
understanding. Once the concepts are clear, a set of exercises given on the
concerned topics would help the students to evaluate themselves and their
progress of learning. The main focus is to enable the students to interact with
the "virtual" teacher in an effective and efficient manner compared to how they
would do in a real lab on the subject.

Objectives
The Software Engineering Virtual Lab has been developed by keeping in mind
the following objectives:
 To impart state-of-the-art knowledge on Software Engineering and UML
in an interactive manner through the Web
 Present case studies to demonstrate the practical applications of different
concepts
 Provide a scope to the students where they can solve small, real life
problems
All the while it is intended to present Software Engineering as an interesting
subject to the students where learning and fun can go alongside.

DESIGNING TEST SUITES


Software Testing
Testing software is an important part of the development life cycle of software.
It is an expensive activity. Hence, appropriate testing methods are necessary for
ensuring the reliability of a program. According to the ANSI/IEEE 1059
standard, the definition of testing is the process of analyzing a software item, to
detect the differences between existing and required conditions i.e.
defects/errors/bugs and to evaluate the features of the software item.
The purpose of testing is to verify and validate software and to find the defects
present in software. The purpose of finding those problems is to get them fixed.
3
Verification is the checking or we can say the testing of software for
consistency and conformance by evaluating the results against pre-specified
requirements.
Validation looks at the systems correctness, i.e. the process of checking that
what has been specified is what the user actually wanted.
Defect is a variance between the expected and actual result. The defect’s
ultimate source may be traced to a fault introduced in the specification, design,
or development (coding) phases.

4
Practical-1
1) Enter the three numbers and find the middle value of three
numbers
function middle(a,b,c)
{
if((a<b &&b<c) || (c<b && b<a))
{
return b;
}
else if((b<a && a<c) || (c<a && a<b))
{
return a;
}
else
{
return c;
}
}

5
6
Explanation:
1. In test 1, we find the middle value of abc. The actual output of abc is 0 in a code
and we expected that the middle value is 0. After execution, the actual output
and expected output is match then we can say that this test case is pass.
2. In test 2, we find the middle value of abc. The actual output of abc is 20 in a
code and we expected that the middle value is 20. After execution, the actual
output and expected output is match then we can say that this test case is pass.
3. In test 3, we find the middle value of abc floating number. The actual output of
abc is 55.5 in a code and we expected that the middle value of abc is 55.5. After
execution, the actual output and expected output is match then we can say that
this test case is pass.
4. In test 4, we find the middle value of abc. The actual output of abc negative
integer is -42 in a code and we expected that the middle value of abc is -42.
After execution, the actual output and expected output is match then we can say
that this test case is pass.
5. In test case 5, we find the middle value of three numbers. The actual output of
three numbers is 85.5 in a code and we expected that the middle value of three
numbers is 75.5. After execution, the actual output and expected output is does
not match, hence we can say that this test case is fail.
6. In test case 6, we find the middle value of three numbers. The actual output of
three numbers is 10 in a code and we expected that the middle value of three
numbers is 5. After execution, the actual output and expected output is does not
match, hence we can say that this test case is fail.
7. In test case 7, we find the middle value of three numbers. The actual output of
three numbers is 10 in a code and we expected that the middle value of three
numbers is 33. After execution, the actual output and expected output is does
not match hence we can say that this test case is fail.
8. In test 8, we find the middle value of abc negative integer number. The actual
output of abc is -150 in a code and we expected that the middle value of abc
negative integer number is -150. After execution, the actual output and expected
output is match then we can say that this test case is pass.
9. In test case 9, we find the middle value of three numbers. The actual output of
three numbers is 0 in a code and we expected that the middle value of
three numbers is 10. After execution, the actual output and expected output is
does not match hence we can say that this test case is fail.
10. In test case 10, we find the middle value of three numbers. The actual output of
three numbers is 15 in a code and we expected that the middle value of three
numbers is 12 but the code does not execute due to syntax error hence we can
say that test case is fail.

7
Practical-2
2) Enter the Number and find the Factorial of a number
function factorial(n)
{
c =1;
result = 1;

for( c = 1 ; c <= n ; c++ )


result = result*c;

return result ;
}

8
9
Explanation:
 In test, we check Factorial of 5. we expected that the output is 120. Then, after execution, the
actual output 5 and expected output 5 is matched then we say that this test is passed.
 In test2, we check Factorial of 7. we expected that the output is 5040. Then, after execution, the
actual output 5040 and expected output 5040 is matched then we say that this test is passed.
 In test3, we check Factorial of divisible number 10/5. we expected that the output is 2. Then,
after execution, the actual output 2 and expected output 2 is matched then we say that this test is
passed.
 In test4, we check Factorial of decimal number 5.0.we expected that the output is 120. Then, after
execution, the actual output 120 and expected output 120 is matched then we say that this test
is passed.
 In test5, we check Factorial of divisible number 25/5.we expected that the output is 120. Then,
after execution, the actual output 120 and expected output 120 is matched then we say that this
test is passed.
 In test7, we check Factorial of decimal number 2.5. Then, after execution, the actual output 2
and expected output 1875 is not matched then we say that this test is failed because a decimal
number is not required.
 In test8, we check Factorial of a. Then, after execution, the actual output 2 and expected output
125422 of is not matched then we say that this test is failed because in a factorial number
character is not required and it doesn’t check the ASCII value.
 In test9, we check Factorial of negative number -5 . Then, after execution, the actual output 1
and expected output 120 is not matched then we say that this test is failed because a factorial of
negative number is not possible.
 In test10, we check Factorial of null value. Then, after execution, the actual output 1 and
expected output 0 is not matched then we say that this test is failed because factorial of null
value is not possible.

10
Practical-3
3) Enter the year and check if it is a leap year or not.
function leapyear(year)
{
return (year % 100 ===0) ? (year % 400 ===0) : (year % 4 === 0);
}

11
12
Explanation:
 In test1, we want to check that 2011 is a leap year or not. If year is divided by 4 is equal to
zero then we can say that this year is a leap year. So, in test1, 2011 is divided by 4 and we
expected that its output is true and after execution, the actual output is false. The expected
output and actual output does not match. So, we can say that this test is failed.
 In test2, we want to check that 2012 is a leap year or not. So, in test2, 2012 is divided by 4
and we expected that its output is true and after execution, the actual output is true. The
expected output and actual output is matched. So, we can say that this test is passed.
 In test3, we want to check that 2013 is a leap year or not. So, in test3, 2013 is divided by 4
and we expected that its output is false and after execution, the actual output is false. So, we
can say that this test is passed.
 In test4, we want to check that 2014 is a leap year or not. So, in test4, 2014 is divided by 4
and we expected that its output is true and after execution, the actual output is false. The
expected output and actual output does not match. So, we can say that this test is failed.
 In test5, we want to check that 2015 is a leap year or not. So, in test5, 2015 is divided by 4
and we expected that its output is true and after execution, the actual output is false. The
expected output and actual output does not match. So, we can say that this test is failed.
 In test6, we want to check that 2016 is a leap year or not. So, in test6, 2016 is divided by 4
and we expected that its output is true and after execution, the actual output is true. The
expected output and actual output is matched. So, we can say that this test is passed.
 In test7, we want to check that 2017 is a leap year or not. So, in test7, 2017 is divided by 4
and we expected that its output is true and after execution, the actual output is false. The
expected output and actual output does not match. So, we can say that this test is failed.
 In test8, we want to check that 2018 is a leap year or not. So, in test8, 2018 is divided by 4
and we expected that its output is false and after execution, the actual output is false. The
expected output and actual output is matched. So, we can say that this test is passed.
 In test9, we want to check that 2019 is a leap year or not. So, in test9, 2019 is divided by 4
and we expected that its output is true and after execution, the actual output is false. The
expected output and actual output does not match. So, we can say that this test is failed.
 In test10, we want to check that 2020 is a leap year or not. So, in test10, 2020 is divided by
4 and we expected that its output is true and after execution, the actual output is true. The
expected output and actual output is matched. So, we can say that this test is passed.

13
Practical-4
4) Enter the sides and get the area of Rhombus

function area(side1,side2)
{
return (side*side2)/2;
}

14
15
Explanation:
 In Test1, we give positive and negative number i.e. 42,-5. Then, after execution, the actual output -
105 and expected output -105 is matched then we say that this test is passed.
 In Test2, we give both negative numbers i.e. -12,-6. Then, after execution, the actual output 36 and
expected output 36 is matched then we say that this test is passed.
 In Test3, we give one multiply equation and second is a number i.e.10*3,4. Then, after execution,
the actual output 60 and expected output 60 is matched then we say that this test is passed.
 In Test4, we give integer numbers i.e.2,5. Then, after execution, the actual output 5 and expected
output 5 is matched then we say that this test is passed.
 In Test5, we give both decimal numbers i.e. 27.1,14.2. Then, after execution, the actual output
192.41 and expected output 192.41 is matched then we say that this test is passed.
 In Test6, we give both integer numbers 42 42. Then, after execution, the actual output 192.41 and
expected output 42 is not matched then we say that this test is fail because because syntax error that
is comma is missing.
 In Test7, we give one integer value and second is a variable i.e. 9,a. Then,
after execution, the actual output 192.41 and expected output 47 is not matched then we say that this
test is failed .
 In Test8, we give first number is addition equation and second number is subtraction equation i.e.
10+3,4-3.Then, after execution, the actual output 6.5 and expected output 6 is not matched then we
say that this test is fail.
 In Test9, we give first integer number and second is divisible equation i.e.5,15/3. Then, after
execution, the actual output 12.5 and expected output 5 is not matched then we say that this test is
fail.
 In Test10, we give first negative divisible equation and second is negative multiplication equation
i.e. -28/7,-4*3. Then, after execution, the actual output 24 and expected output 15 is not matched
then we say that this test is fail.

16
Practical-5
5) Code for enter the character (vowels only) and find its ASCII value
function square(side) {
switch (side) {
case "a":
side = 97;
break;
case "e":
side = 101;
break;
case "i":
side = 105;
break;
case "o":
side = 111;
break;
case "u":
side = 117;
break;
case "A":
side = 65;
break;
case "E":
side = 69;
break;
case "I":
side = 73;
break;
case "O":
side = 79;
break;
case "U":
side = 85;
break;
default:
side = "NaN";
}
return side;
}

17
18
Explanation:
 In test1, we find the ASCII value of “a”. We define the ASCII value of “a” in a code is 97 and in test
cases, we expected that the ASCII value of “a” is 97. Then, after execution, the actual output and
expected output of “a” is matched then we say that this test is passed.
 In test2, we find the ASCII value of “A”. We define the ASCII value of “A” in a code is 65 and in test
cases, we expected that the ASCII value of “A” is 97. After execution, the expected output does not
match with the actual output of “A” then we say that this test is failed.
 In test3, we find the ASCII value of “e”. We define the ASCII value of “e” in a code is 101 and in test
cases, we expected that the ASCII value of “e” is 101. Then, After execution, the actual output and
expected output of “e” is matched then we say that this test is passed.
 In test4, we find the ASCII value of “E”. we define the ASCII value of “E” in a code is 69 and in test
cases, we expected that the ASCII value of “E” is 101. After execution, the expected output does not
match with the actual output of “E” then we say that this test is failed.
 In test5, we find the ASCII value of “i”. we define the ASCII value of “i” in a code is 105 and in test
cases, we expected that the ASCII value of “i” is 105. After execution, the actual output and expected
output of “i” is matched then we say that this test is passed.
 In test6, we find the ASCII value of “I”. we define the ASCII value of “I” in a code is 73 and in test
cases, we expected that the ASCII value of “I” is 105. After execution, the expected output does not
match with the actual output of “I” then we say that this test is failed.
 In test7, we find the ASCII value of “o”. we define the ASCII value of “o” in a code is 111 and in test
cases, we expected that the ASCII value of “o” is 111. After execution, the actual output and expected
output of “o” is matched then we say that this test is passed.
 In test8, we find the ASCII value of “O”. we define the ASCII value of “O” in a code is 79 and in test
cases, we expected that the ASCII value of “O” is 111. After execution, the expected output does not
match with the actual output of “O” then we say that this test is failed.
 In test9, we find the ASCII value of “u”. we define the ASCII value of “u” in a code is 117 and in test
cases, we expected that the ASCII value of “u” is 117. After execution, the actual output and expected
output of “u” is matched then we say that this test is passed.
 In test10, we find the ASCII value of “U”. we define the ASCII value of “U” in a code is 85 and in test
cases, we expected that the ASCII value of “U” is 117. After execution, the expected output does not
match with the actual output of “U” then we say that this test is failed.

19
Practical-6

6)Enter the number and check if the given number is prime or not.
function IsPrime($n)
{
for($x=2; $x<$n; $x++)
{
if($n %$x ==0)
{
return 0;
}
}
return 1;

20
21
Explanation:
 In test1, we check Prime number 19. we expected that the output is 1. Then, after
execution, the actual output and expected output of 19 is matched then we say that this
test is passed.
 In test2, we check Prime number 8237. we expected that the output is 1. Then, after
execution, the actual output and expected output of 8237 is matched then we say that this
test is passed.
 In test3, we check Prime number 694201. we expected that the output is 1. Then,after
execution, the actual output and expected output of 694201 is matched then we say that
this test is passed.
 In test4, we check Prime number 56397629.we expected that the output is 1. Then, after
execution, the actual output and expected output of 56397629 is matched then we say that
this test is passed.
 In test5, we check Prime number36.we expected that the output is 0. Then, after
execution, the actual output and expected output of 36 is matched then we say that this
test is passed.
 In test6, we check Prime number 33.42. Then, after execution, the actual output and
expected output of 33.42 is not matched then we say that this test is failed because a
decimal number is not required.
 In test7, we check Prime number 75 1. Then, after execution, the actual output and
expected output of 75 1 is not matched then we say that this test is failed because in a prime
number spacing is not required.
 In test8, we check Prime number 23a1. Then, after execution, the actual output and
expected output of 23a1 is not matched then we say that this test is failed because in a prime
number character is not required and it doesn’t check the ASCII value.
 In test9, we check Prime number -11. Then, after execution, the actual output and expected
output of -11 is not matched then we say that this test is failed because a negative number
is not a prime number.
 In test10, we check Prime number 3+2. Then, after execution, the actual output and
expected output of 3+2 is not matched then we say that this test is failed because add
operation is not done in a prime number.

22
Practical-7

7)Enter the Sides and get the Triangle Type.


function triangle( $x, $y, $z )
{
if( $x >= ( $y + $z ) || $z >= ( $x + $y ) || $y >= ( $x + $z ) )
{
return "nottriangle" ;
}
else if( $x == $y && $y== $z )
{
return "Equilateral" ;
}
else if( $x == $y || $y == $z || $x == $z )
{
return "Isosceles" ;
}
else
{
return "Scalene" ;
}
}

23
24
Explanation:
 In test1, we check whether the given points made a triangle or not. Then, after
execution, the actual output and expected output not triangle is matched then we say that
this test is passed.
 In test2, we check whether a triangle is scalene in which all the sides of triangle are
different. Then, after execution, the actual output and expected output of test is matched,
then we say that this test is passed.
 In test3, we check whether a triangle is isosceles in which two sides of triangle are
same. Then, after execution, the actual output and expected output is matched then we
say that this test is passed.
 In test4, we check whether a triangle is equilateral in which all sides of triangle are
same. Then, after execution, the actual output and expected output is matched then we
say that this test is passed.
 In test5, we check whether a triangle is isosceles in which two sides of triangle are
same. Then we suspect that output of triangle is isosceles but the sum of two sides is
less than third so no triangle is made. Then, after execution, the actual output and
expected output not matched then we say that this test is failed.
 In test6, we check whether a triangle is isosceles in which two sides of triangle are
same. Then, after execution, the actual output and expected output is matched then we
say that this test is passed.
 In test7, we check value, not the float value. Then, after execution, the actual output
and expected output not matched then we say that this test is failed because in this it
consider 2 values same so, it is considered as isosceles.
 In test8, we check whether a triangle is scalene in which all sides of triangle are
different. Then, after execution, the actual output and expected output not matched then
we say that this test is failed because in this it consider negative and positive value same
so, it is considered as isosceles.
 In test9, we check whether a triangle is scalene in which all sides of triangle are
different. Then, after execution, the actual output and expected output not matched then
we say that this test is failed because in this it consider all the sides are different and
sum of two sides are less than the third so, it is considered as not triangle.
 In test10, we check whether a triangle is scalene in which all the sides of triangle are
different. Then, after execution, the actual output and expected output of test is matched,
then we say that this test is passed.

25
Practical-8

8) Write a code for enter the P.R.T and calculate the simple interest.
function si(p,r,t)
{
return p*r*t/100 ;
}

26
Explanation:-
1. In test 1 we find the simple interest rate of PRT we define the value of PRT is 60 in a
code we expected that the simple interest of PRT is 60 after execution the actual output
and expected output is match then we can say that this test case is pass.
2. In test 2 we find the simple interest rate of PRT negative number we define the value of
PRT is -240 in a code we expected that the simple interest rate of negative number of
PRT is -240 after execution the actual output and expected output is match then we can
say that this test case is pass.
3. In test 3 we find the simple interest rate of PRT we define the value of PRT is 1200 in a
code we expected that the simple interest rate of PRT is 1200 after execution the actual
output and expected output is match then we can say that this test case is pass.
4. In test 4 we find the simple interest rate of PRT we define the value of PRT is 50 in a
code we expected that the simple interest rate of PRT is 50 after execution the actual
output and expected output is match then we can say that this test case is pass.
5. In test 5 we find the simple interest rate of floating number of PRT we define the value
of PRT is 68.365 in a code we expected that the simple interest rate of floating number of
PRT is 68.365 after execution the actual output and expected output is match then we can
say that this test case is pass.
6. .In test 6 we find the simple interest rate of PRT we define the value of PRT is 0 in a
code we expected that the simple interest rate of PRT is 10 after execution the actual
output and expected output is not match hence we can say that test case is fail.
7. In test 7 we find the simple interest rate of of PRT we define the value of PRT is 1.5
in a code we expected that the simple interest rate of of PRT is 5 after execution the
actual output and expected output is not match hence we can say that test case is fail.
8. In test 8 we find the simple interest rate floating number of PRT we define the value of
PRT is 18.75 in a code we expected that the simple interest rate of floating number of
PRT is 15 after execution the actual output and expected output is not match hence we
can say that test case is fail.
9. In test 9 we find the simple interest rate of PRT we define the value of PRT is
0.01 in a code we expected that the simple interest rate of null number of PRT is 1 after
execution the actual output and expected output is not match hence we can say that test
case is fail.
10. In test 10 we find the simple interest rate of negative number of PRT we define the
value of PRT is 60000 in a code we expected that the simple interest rate of negative
number of PRT is 6000after execution the actual output and expected output is not match
hence we can say that test case is fail.

27
Practical-9
9) Enter the P,R,T and calculate the Compound Interest
function area(p,r,t)
{
return
(p * (Math.pow((1 + (r / 100)), t)));
}

28
29
Explanation:
 In test1, we find the ASCII value of “a”. We define the ASCII value of “a” in a code is 97 and
in test cases, we expected that the ASCII value of “a” is 97. Then, after execution, the actual
output and expected output of “a” is matched then we say that this test is passed.
 In test2, we find the ASCII value of “A”. We define the ASCII value of “A” in a code is 65 and
in test cases, we expected that the ASCII value of “A” is 97. After execution, the expected
output does not match with the actual output of “A” then we say that this test is failed.
 In test3, we find the ASCII value of “e”. We define the ASCII value of “e” in a code is 101 and
in test cases, we expected that the ASCII value of “e” is 101. Then, After execution, the actual
output and expected output of “e” is matched then we say that this test is passed.
 In test4, we find the ASCII value of “E”. we define the ASCII value of “E” in a code is 69 and
in test cases, we expected that the ASCII value of “E” is 101. After execution, the expected
output does not match with the actual output of “E” then we say that this test is failed.
 In test5, we find the ASCII value of “i”. we define the ASCII value of “i” in a code is 105 and
in test cases, we expected that the ASCII value of “i” is 105. After execution, the actual output
and expected output of “i” is matched then we say that this test is passed.
 In test6, we find the ASCII value of “I”. we define the ASCII value of “I” in a code is 73 and in
test cases, we expected that the ASCII value of “I” is 105. After execution, the expected output
does not match with the actual output of “I” then we say that this test is failed.
 In test7, we find the ASCII value of “o”. we define the ASCII value of “o” in a code is 111 and
in test cases, we expected that the ASCII value of “o” is 111. After execution, the actual output
and expected output of “o” is matched then we say that this test is passed.
 In test8, we find the ASCII value of “O”. we define the ASCII value of “O” in a code is 79 and
in test cases, we expected that the ASCII value of “O” is 111. After execution, the expected
output does not match with the actual output of “O” then we say that this test is failed.
 In test9, we find the ASCII value of “u”. we define the ASCII value of “u” in a code is 117 and
in test cases, we expected that the ASCII value of “u” is 117. After execution, the actual output
and expected output of “u” is matched then we say that this test is passed.
 In test10, we find the ASCII value of “U”. we define the ASCII value of “U” in a code is 85 and
in test cases, we expected that the ASCII value of “U” is 117. After execution, the expected
output does not match with the actual output of “U” then we say that this test is failed.

30
Practical-10
10) Enter the sides and get the Area of Triangle

function num($a,$b,$c)
{
$s=($a+$b+$c)/2;
return Math.sqrt($s*($s-$a)*($s-$b)*($s-$c));
}

31
32
Explanation:
 In test1, we give three integers which are 12,10,8. Then, after execution, the actual
output and expected output is not matched then we say that this test is fail because actual
output gives the float value.
 In test2, we give three float values which are 12.4,14.4,16.5. After execution, the
expected output does not match with the actual output of then we say that this test is
failed because actual output gives the double float value .
 In test3, we give three negative values which are -12,-10,-8.Then, After execution, the
actual output and expected output is not matched then we say that this test is fail because
actual output gives the float value.
 In test4, we give first value is positive, second and third value is negative i.e. 1.5,-7.5,-
4.3.After execution, the expected output does not match with the actual output then we
say that this test is failed.
 In test5, we give two integers value and one is ASCII value i.e.10,a,12.After execution,
the actual output and expected output of is not matched then we say that this test is fail
because it doesn’t check the ASCII value.
 In test6, we give first negative value, second and third value is positive which are-
1.2,12,12. After execution, the expected output does not match with the actual output
then we say that this test is failed because actual output gives the float value.
 In test7, we give three multiple values which are 4*3, 5*2,4*2.After execution, the actual
output and expected output is not matched then we say that this test is fail.
 In test8, we give only two values which are 12 and 10. After execution, the expected
output does not match with the actual output of then we say that this test is failed because
it contains only two values.
 In test9, we give three integers values which are 5 7,9. After execution, the actual output
and expected output is not matched then we say that this test is fail because syntax error
that comma is missing.
 In test10, we give three integers values which are 5,7,9. After execution, the expected
output does not match with the actual output then we say that this test is failed because
actual output gives the float value.

33
Practical-11

11) Enter three numbers and find the greatest of three numbers.

function largest(x,y,z)
{
if(x>y && x>z)
{
return x;
}
else if(y>x && y>z)
{
return y;
}
else if(z>=x && z>y)
{
return z;
}
}

34
35
Explanation:
1. In test 1, we find the largest value of xyz. The actual output of xyz is undefined in a
code and we expected that the largest value of xyz is 0. After execution, the actual
output and expected output is not match then we can say that this test case is fail.
2. In test 2, we find the largest value of xyz. The actual output of xyz is 12 in a code
and we expected that the largest value of xyz is 12. After execution, the actual
output and expected output is match then we can say that this test case is pass.
3. In test 3, we find the largest value of xyz. The actual output of xyz is undefined in a
code and we expected that the largest value of xyz is 8. After execution, the actual
output and expected output is not match then we can say that this test case is fail.
4. In test 4, The actual output of xyz is undefined in a code and we expected that the
largest value of xyz is 25. After execution, the actual output and expected output is
not match then we can say that this test case is fail.
5. In test 5, we find the largest value of xyz. The actual output of xyz is 89 in a code
and we expected that the largest value of xyz is 89. After execution, the actual
output and expected output is match then we can say that this test case is pass.
6. In test 6, we find the largest value of xyz. The actual output of xyz is 10 in a code
and we expected that the largest value of xyz is 10. After execution, the actual
output and expected output is match then we can say that this test case is pass.
7. In test 7, The actual output of xyz is 128 in a code and we expected that the largest
value of xyz is 128. After execution, the actual output and expected output is match
then we can say that this test case is pass.
8. In test 8, The actual output of xyz is 1 in a code and we expected that the largest
value of xyz is 1. After execution, the actual output and expected output is match
then we can say that this test case is pass.
9. In test 9, we find the largest value of xyz. The actual output of xyz is 30 in a code
and we expected that the largest value of xyz is 30. After execution, the actual
output and expected output is match then we can say that this test case is pass.
10. In test 10, we find the largest value of xyz. The actual output of xyz is 4 in a code
and we expected that the largest value of xyz is 9. After execution, the actual
output and expected output is not match then we can say that this test case is fail.

36

You might also like