Software Testing Lab Manual 4
Software Testing Lab Manual 4
Lab Manual
Prepared By:
Saru Dhir
1
Credit Units: 1 Course Code: IT409
Course Objectives:
Pre-requisites:
Software engineering
List of Experiments:
2
Lab/Practicals details, if applicable:
3
Table of Contents
Experiment Description
Page
No. No.
1 Design test cases using Boundary value analysis by taking
quadratic equation problem 5
2 Design test cases using Equivalence class partitioning taking 8
triangle problem
3 Design test cases using Decision table taking triangle problem 12
4 Design independent paths by calculating cyclometic complexity 15
using date problem
5 Design independent paths by taking DD path using date problem 18
6 Design the test cases for login page of AMIZONE 21
7 Manual Testing for PAN card verification 26
8 Generate test case for ATM machine 27
9 Overview of Testing process using Rational Robot 28
Write a script to record verification point using Rational Robot (For 34
10 GUI testing of single click on window OS)
Write a script to record verification point for Clip Board and 42
11 alphanumeric values using Rational Robot
Write a script to record verification point for CASE INSENSITIVE 44
12 values using Rational Robot
Write a script to record verification point for RANGE values using 46
13 Rational Robot
Write a script to record verification point for OBJECT PROPERTIES 49
14 values using Rational Robot
4
Experiment 1
AIM: Design test cases using Boundary value analysis by taking quadratic
equation problem
THEORY:
Boundary Value Analysis is a test case design technique, if there is lot of input text
boxes and dropdown boxes then will use Boundary Value analysis technique to
simplify the test design. By using Boundary Value Analysis technique testers will
create test cases for the data input required fields. Partition system inputs and outputs
into’ equivalence sets’
EXAMPLE 1
– If input is a 5-digit integer between 10,000 and 99,999, equivalence partitions are
< 10,000, 10,000 - 99, 999 and > 10, 000
• Choose test cases at the boundary of these sets
– 00000, 09999, 10000, 99999, 10001
EXAMPLE 2
Consider a program with two input variables x and y. These input variables have
specified boundaries as:
a≤x≤b
c≤y≤d
The boundary value analysis test cases for our program with two inputs variables (x
and y) that may have any value from 100 to 300 are: (200,100), (200,101), (200,200),
(200,299), (200,300), (100,200), (101,200), (299,200) and (300,200). This input
domain is shown in Figure. Each dot represents a test case and inner rectangle is the
domain of legitimate inputs. Thus, for a program of n variables, boundary value
analysis yield 4n + 1 test cases.
5
following words: Not a Quadratic Equation, Real roots, Imaginary roots and Equal
roots. Design the boundary value test cases.
PROGRAM
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include
#include
void main( )
{
clrscr( );
int a,b,c,d;
2
cout<<"The quadratic equation is of the type a(x )+bx+c=0" <cout<<"Enter the
value of a:"<<end1;
cin>>a;
cout<<"Enter the value of
b:"<cin>>b; cout<<"Enter the value
of c: "<cin>>c; d = (b*b)-4*a*c;
if((a<0)||(b<0)||(c<0)||(a>100)||(b>100)||(c>100))
cout«"Invalid input"«end1;
elseif(a==0)
cout<<"Not a quadratic
equation"< elseif(d==0)
cout<<"Roots are
equal"< else if(d<0)
cout<<"Imaginary
roots"<<end1; else
cout<<"Real
roots"< getch();
}
</end1;
</end1;
In the above program, we consider the values as 0 (Minimum), 1 (Just above Minimum),
50 (Nominal), 99 (Just below Maximum) and 100 (Maximum)
6
3 50 50 50 Imaginary Roots Imaginary Roots
TEST RESULTS
We have performed 13 test cases to perform boundary value analysis on Quadratic
Equations which has resulted into following expected outputs.
7
Experiment 2
AIM: Design test cases using Equivalence class partitioning by taking triangle
problem
1. The equivalence classes are identified by taking each input condition and
partitioning it into valid and invalid classes. For example, if an input
condition specifies a range of values from 1 to 999, we identify one valid
equivalence class [1<item<999]; and two invalid equivalence classes
[item<1] and [item>999].
2. Generate the test cases using the equivalence classes identified in the
previous step. This is performed by writing test cases covering all the valid
equivalence classes. Then a test case is written for each invalid equivalence
class so that no test contains more than one invalid class. This is to ensure
that no two invalid classes mask each other.
Most of the time, equivalence class testing defines classes of the input domain.
However, equivalence classes should also be defined for output domain. Hence,
we should design equivalence classes based on input and output domain.
Consider a program for the classification of a triangle. Its input is a triple of positive
integers (say a,b,c) from the interval [1,100]. The output may be [Scalene, Isosceles,
Equilateral, Not a triangle].
PROGRAM USED:
8
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter first side");
scanf("%d",&a);
printf("Enter second
side"); scanf("%d",&b);
printf("Enter third side");
scanf("%d",&c);
if((a+b)<c)
{
printf("It is not a triangle");
}
else if((a==b)&&(b==c)&&(c==a))
{
printf("It is an equilateral triangle");
}
else if((a==b)||(b==c)||(c==a))
{
printf("It is an isoscales triangle");
}
else if ((a!=b)&&(b!=c)&&(c!=a))
{
printf("It is an scales triangle");
}
getch();
}
TEST CASES:
9
S.NO. a b c Expected Error
Output Refining
1. 50 100 50 Not a
Triangle
2. 100 99 50 Scalene
Triangle
3. 50 50 99 Isosceles
Triangle
4. 50 50 50 Equilateral
Triangle
10
I18= {<x,y,z>: y>x+z}
TEST RESULTS
We have performed 4 test cases to perform Output Domain Equivalence Class
Testing while there are 20 test cases to perform Input Domain Equivalence Class
Testing of A triangle problem which has resulted into above expected outputs.
.
11
Experiment 3
AIM: Design test cases using Decision table by taking triangle problem
In case of Decision Based Table method a set of conditions are defined and based on
them the corresponding actions are performed. Based on n inputs i.e. conditions
n
there are 2 possible actions.
Consider a program for the determination of type of triangle. Its input is a triple of
positive integers (say a,b,c) from the interval [1,100]. The output may be Scalene or
Isosceles or Equilateral or Not a triangle.
PROGRAM USED:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter first side");
scanf("%d",&a);
printf("Enter second side");
scanf("%d",&b);
printf("Enter third side");
scanf("%d",&c);
if(((a+b)<c)||((a+c)<b)||((b+c)<a)))
printf("Not a triangle");
else if((a==b)&&(b==c)&&(c==a))
printf("Equilateral triangle");
else if((a==b)||(b==c)||(c==a))
else if ((a!=b)&&(b!=c)&&(c!=a))
printf("Scales triangle");
getch();
}
12
DECISION TABLE
Actions :
a1= Not a Triangle
a2= Scalene Triangle
a3= Isosceles Triangle
a4= Equilateral Triangle
a5= Impossible
a2:Scalene Triangle X
a3:IsoscelesTriangle X X X
a:Equilateral Triangle X
X X X
a5: Impossible
Decision Table
C1: a<b+c? F T T T T T T T T T T
C2: b<a+c? - F T T T T T T T T T
C3: c<a+b? - - F T T T T T T T T
C4: a=b? - - - T T F F F T T F
C5: a=c? - - - T F T F T F T F
C6: b=c? - - - F T T T F F T F
a1= Not a Triangle X X X
a2:Scalene Triangle X
a3:Isosceles Triangle X X X
a4:EquilateralTriangle X
a5: Impossible X X X
Elaborated Decision Table
TEST CASES
TEST RESULTS: Various conditions are taken into account and respective actions
based on them are identified, thus generating the required test cases for the problem
statement.
14
Experiment 4
SOFTWARE REQUIRED : C
PROBLEM STATEMENT : Given the present date in the form of a triplet of Day,
Month and Year. To check whether the date is valid or invalid. If valid then output is
the previous date.
PROGRAM
# include<iostream.h>
# include<conio.h>
1. void main()
2. {
3. clrscr();
4. int day,month,year,flag=0;
5. int prev_day,prev_month,prev_year;
6. cout<<"enter the date(dd/mm/yyyy):";
7. cout<<"\n enter the day:";
8. cin>>day;
9. cout<<"\n enter the month:";
10. cin>>month;
11. cout<<"\n enter the year:";
12. cin>>year;
13. if((day>=1 && day<=31)&&(month==1 || month==3||month==5||month==7||
month==8|| month==10||month==12)&& (year>=1))
14. {
15. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
16. flag=1;
17. }
15
18. else if((day>=1 && day<=30)&&(month==4 || month==6||month==9||
month==11)&& (year>=1))
19. {
20. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
21. flag=1;
22. }
23. else if((day>=1 && day<=29) && (month==2) && (year>=1) && ((year
%100==0 && year%400==0)||(year%100!=0 && year%4==0)))
24. {
25. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
26. flag=1;
27. }
28. else if((day>=1 && day<=28) && (month==2) &&(year>=1))
29. {
30. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
31. flag=1;
32. }
33. else
34. {
35. cout<<"\n The date is invalid";
36. }
/*calculating previous date*/
37. if(flag==1)
38. {
39. if(day>=2)
40. {
41. prev_day=--day;
42. cout<<"\nThe previous date is:"<<prev_day<<"/"<<month<<"/"<<year;
43. }
44. else if(day==1)
45. {
46. if(month==1)
47. {
48. prev_day=31;
49. prev_month=12;
50. prev_year=--year;
51. cout<<"\nThe previous date
is:"<<prev_day<<"/"<<prev_month<<"/"<<prev_year;
52. }
53. if(month==5||month==7||month==10||month==12)
54. {
55. prev_day=30;
56. prev_month=--month;
57. cout<<"\nThe previous date is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
58. }
59. else if(month==2||month==4||month==6||month==8||month==9||
month==11)
60. {
61. prev_day=31;
62. prev_month=--month;
63. cout<<"\nThe previous date is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
16
64. }
65. else if(month==3)
66. {
67. if((year %100==0 && year%400==0)||(year%100!=0 && year%4==0))
68. {
69. prev_day=29;
70. prev_month=--month;
71. cout<<"\nThe previous date
is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
72. }
73. else
74. {
75. prev_day=28;
76. prev_month=--month;
77. cout<<"\nThe previous date
is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
78. }
79. }
80. }
81. }
82. getch();
83. }
Conclusion: With the help of flow graph, Number of Independent path will be
calculated
17
Experiment 5
SOFTWARE REQUIRED : C
THEORY : DD path Graph is the reduced form of the original graph of a program.
It is created in order to provide simplicity in case of programs which have a large
number of Line Of Code(LOC). It is done by merging the linear continuous set of
instructions by a single node, keeping the decision nodes as it is. Thus reducing the
size of the original graph.
PROBLEM STATEMENT : Given the present date in the form of a triplet of Day,
Month and Year. To check whether the date is valid or invalid. If valid then output is
the previous date.
PROGRAM
# include<iostream.h>
# include<conio.h>
1. void main()
2. {
3. clrscr();
4. int day,month,year,flag=0;
5. int prev_day,prev_month,prev_year;
6. cout<<"enter the date(dd/mm/yyyy):";
7. cout<<"\n enter the day:";
8. cin>>day;
9. cout<<"\n enter the month:";
10. cin>>month;
11. cout<<"\n enter the year:";
12. cin>>year;
13. if((day>=1 && day<=31)&&(month==1 || month==3||month==5||month==7||
month==8|| month==10||month==12)&& (year>=1))
14. {
15. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
16. flag=1;
17. }
18. else if((day>=1 && day<=30)&&(month==4 || month==6||month==9||
month==11)&& (year>=1))
19. {
20. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
21. flag=1;
22. }
23. else if((day>=1 && day<=29) && (month==2) && (year>=1) && ((year
%100==0 && year%400==0)||(year%100!=0 && year%4==0)))
24. {
18
25. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
26. flag=1;
27. }
28. else if((day>=1 && day<=28) && (month==2) &&(year>=1))
29. {
30. cout<<"the date entered is valid:"<<day<<"/"<<month<<"/"<<year;
31. flag=1;
32. }
33. else
34. {
35. cout<<"\n The date is invalid";
36. }
/*calculating previous date*/
37. if(flag==1)
38. {
39. if(day>=2)
40. {
41. prev_day=--day;
42. cout<<"\nThe previous date is:"<<prev_day<<"/"<<month<<"/"<<year;
43. }
44. else if(day==1)
45. {
46. if(month==1)
47. {
48. prev_day=31;
49. prev_month=12;
50. prev_year=--year;
51. cout<<"\nThe previous date
is:"<<prev_day<<"/"<<prev_month<<"/"<<prev_year;
52. }
53. if(month==5||month==7||month==10||month==12)
54. {
55. prev_day=30;
56. prev_month=--month;
57. cout<<"\nThe previous date is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
58. }
59. else if(month==2||month==4||month==6||month==8||month==9||
month==11)
60. {
61. prev_day=31;
62. prev_month=--month;
63. cout<<"\nThe previous date is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
64. }
65. else if(month==3)
66. {
67. if((year %100==0 && year%400==0)||(year%100!=0 && year%4==0))
68. {
69. prev_day=29;
70. prev_month=--month;
71. cout<<"\nThe previous date
is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
19
72. }
73. else
74. {
75. prev_day=28;
76. prev_month=--month;
77. cout<<"\nThe previous date
is:"<<prev_day<<"/"<<prev_month<<"/"<<year;
78. }
79. }
80. }
81. }
82. getch();
83. }
Conclusion: With the help of DD path graph, Number of Independent path will be
calculated
20
Experiment 6
HOME PAGE:
test URL : https://www.amizone.net
Preconditions: Open Web browser and enter the given url in the address bar. Home
page must be displayed. All test cases must be executed from this page.
Test Test test case test steps test test test defect
case id case desc Step expected actual case status prority severity
name status (P/F)
Login01 Validate To verify enter login an error design high
Login that Login name less message
name on than 3 chars “Login
login page (say a) and not less
must be password than 3
greater and click character
than 3 Submit s” must
characters button be
displayed
enter login an error design high
name less message
than 3 chars “Login
(say ab) and not less
password than 3
and click character
Submit s” must
button be
displayed
enter login Login design high
name 3 success
chars (say full or an
abc) and error
password message
and click “Invalid
Submit Login or
button Passwor
d” must
be
displayed
Login02 Validate To verify enter login an error design high
Login that Login name message
name on greater than “Login
login page 10 chars not
should not (say greater
be greater abcdefghijk) than 10
than 10 and character
21
characters password s” must
and click be
Submit displayed
button
22
enter Login design high
Password 6 success
chars (say full or an
abcdef) and error
Login Name message
and click “Invalid
Submit Login or
button Passwor
d” must
be
displayed
Pwd02 Validate To verify enter an error design high
Passwor that Password message
d Password greater than “Passwor
on login 10 chars d not
page must (say a) and greater
be less Login Name than 10
than 10 and click character
characters Submit s” must
button be
displayed
enter Login design high
Password success
less than 10 full or an
chars (say error
abcdefghi) message
and Login “Invalid
Name and Login or
click Submit Passwor
button d” must
be
displayed
Pwd03 Validate To verify enter Login design high
Passwor that Password success
d Password with special full or an
on login characters(s error
page must ay !@hi&*P) message
be allow Login Name “Invalid
special and click Login or
characters Submit Passwor
button d” must
be
displayed
Llnk01 Verify To Verify Click Home Home design low
Hyperlin the Hyper Link Page
ks Links must be
available at displayed
left side on Click Sign Sign Up design low
login page Up Link page
working or must be
not displayed
Click New New design low
Users Link Users
Registrati
on Form
must be
23
displayed
Click Page with design low
Advertise Informati
Link on and
Tariff
Plan for
Advertise
rs must
be
displayed
Click Contact design low
Contact Us Informati
Link on page
must be
displayed
Click Terms Terms Of design low
Link the
service
page
must be
displayed
Flnk01 Verify To Verify Click Home Home design low
Hyper the Hyper Link Page
links Links must be
displayed displayed
at Footer Click Sign Contact design low
on login Up Link Informati
page on page
working or must be
not displayed
Click Page with design low
Contact Us Informati
Link on and
Tariff
Plan for
Advertise
rs must
be
displayed
Click Terms Of design low
Advertise the
Link service
page
must be
displayed
Click Terms Privacy design low
Of Policy
Membership page
Link must be
displayed
Click Privacy design low
Privacy Policy
Policy Link page
must be
displayed
Lblnk01 Verify To Verify Click NEW New design low
24
Hyper the Hyper USERS Link Users
links Links located in Registrati
displayed login box on Form
at Login must be
Box on displayed
login page Click New New design low
working or Users(Blue Users
not Color) Link Registrati
located in on Form
login box must be
displayed
Click Forget Passwor design mediu
Password d m
Link located Retrieval
in login box Page
must be
displayed
Conclusions:
25
Experiment 7
Test Expected
Case Name Description Steps Result Priority
Verify if next 4
characters are
2 Next 4 characters numerals i) Characters are alphabets Invalid! Medium
Conclusions:
Test cases have been formulated and PAN card number has been checked.
26
Experiment 8
Continue
7) transaction a) Yes 1) Enter the options 1) High
b) No 2) Exit 2) High
Conclusions:
Test cases have been formulated and ATM card has been tested.
Experiment 9
27
AIM: Overview of Testing process using Rational Robot
Step 2: On Admin Window right click on Project and enter Project name
and Location
28
Step 3: Keep Password Blank and click on next->finish
Step 4: On a new Configuration Project Window under Test Assets click on Create
29
Step 5: Select the Microsoft Access as the Database and click on next -> finish
30
Step 6: In the Rational Administrator window click on Rational Robot Icon that
th
is 10 from right
Step 7: After giving the name a GUI Record Window is displayed as follows
31
Step 8: You may now perform any function on the operating system and this
GUI will record each and every event that occurs
Step 9: Stop the recording and click on third icon named Specify Log Information
and make build file giving your testing name and a new window will open
containing log information specifying whether it is pass or fail
32
Conclusion: We understood all the steps needed to work on Rational Robot
33
Experiment 10
AIM: Write a script to record verification point using Rational Robot (For GUI
testing of single click on window OS)
Steps:
1.) File>New>Script.
2.) Name : Login1
Description=Log in to the Classics Online
Application 3. ) Press Ok
4.) In Rational robot main Window
Place cursor at the beginning of blank line after start application
command 5.) Record>Insert at cursor
6.) On GUI Record toolbar click Display GUI Insert
Toolbar 7.) click write to Log
Message=Verify the initial state of classics online application
Description=The next VP will verify initial state of classics
Online. Result option=None
Ok
8.)On GUI Record Toolbar click display GUI Insert
Toolbar Click windows Existence
Name=Login1
Ok
Click Select
Drag Object Finder pointer to Classics Login Dialog Box and release the
mouse Ok
Ok
9.)In classics Login dialog box,click ok
10.)On GUI Record toolbar , click Stop Recording
button. 11.)Exit Classics Online.
12.)Playback the script file>Playback(Select Login1>ok,Accept default log
info.) 13.) Look at the results.
1. we can do testing with our manual script file script1. click on insert-verification
point- 13 options are available like Alphanumeric, Object, Menu, Object
properties etc.
34
14. if we want to test object properties, select it
Click ok.
35
Object finder tool will available. Click on tool (hand icon) and drag on the object or
button where you want to test the properties of classic online script file.
Suppose I leave it on order it button. Click ok. Then its properties will detect.
36
All properties are identified and display.
We can do modifications in the properties. After that click ok. It will come to
normal windoe.
37
Now we have to run both of the script file. Click on playback script icon, that is
displayed on standard toolbar.
A playback window will open. Where we have to choose our script1 file.
38
Click ok
Click ok
39
12 result will display
40
Experiment 11
AIM: Write a script to record verification point for Clip Board and
alphanumeric values using Rational Robot
41
42
Experiment 12
43
44
Experiment 13
AIM: Write a script to record verification point for RANGE values using
Rational Robot
45
46
Conclusion: We checked the script and got the results in terms of pass/fail.
47
Experiment 14
Conclusion: We checked the script and got the results in terms of pass/fail.
48