Professional Documents
Culture Documents
SESSION : 2022-23
PRACTICAL FILE
SOFTWARE TESTING AND QUALITY ASSURANCE
( BTDSE-512N )
LAB CONTENTS
S. No. Experiment Page no. Date of Sign/
Experiment Remarks
Ex. No. – 01 Design test cases using Boundary value analysis by taking quadratic
equation problem.
a≤x≤b
c≤y≤d
Consider a problem for the determination of the nature of the roots of a quadratic
equation where the inputs are 3 variables (a, b, c) and their values may be from the interval
[0, 100]. The output may be one of the following depending on the values of the variables:
Not a quadratic equation,
Real roots,
Imaginary roots,
Equal roots
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Solution
Quadratic equation will be of type:
ax2+bx+c=0
Roots are real if (b2-4ac)>0
Roots are imaginary if (b2-4ac)
Roots are equal if (b2-4ac)=0
Equation is not quadratic if a=0
Program
import java.util.*;
OUTPUT:
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Ex. No. – 02 Design test cases using Equivalence class partitioning taking triangle
problem.
Program
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
expout = sc.next();
Output
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Ex. No. – 03 Design test cases using Decision table taking triangle problem.
Decision tables are used in various engineering fields to represent complex logical
relationships. This testing is a very effective tool in testing the software and its requirements
management. The output may be dependent on many input conditions and decision tables
give a tabular view of various combinations of input conditions and these conditions are in
the form of True(T) and False(F). Also, it provides a set of conditions and its corresponding
actions required in the testing.
Program
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
Result |");
System.out.println("| | | | | |
|");
for (int i = 0; i < side.size(); i++) {
float[] sides = side.get(i);
System.out.printf("| %4.1f | %4.1f | %4.1f | %-11s | %-11s | %-
4s |\n", sides[0], sides[1], sides[2], exp.get(i), triangle.get(i),(
exp.get(i).equals(triangle.get(i))) ? "PASS" : "FAIL");
}
System.out.println("
");
}
}
Output
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Ex. No. – 04 Design independent paths by calculating cyclometer complexity using date
problem..
Program
import java.util.Scanner;
if ((month == 2 || month == 4 || month == 6 || month == 9 || month == 11) && day > 30)
{
return false;
}
return true;
}
}
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Output
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Ex. No. – 05 Design independent paths by taking DD path using date problem.
Problem Statement:
Give the present date in the form of a triplet of day, month and year. Tocheck whether the
date given is valid or invalid. If valid then the output is previous date
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int day,month,year,flag=0;
int prev_day, prev_month, prev_year;
Printf(“enter the date=dd-mm-yy”);
Printf(“\nenter the day:”);
Scanf(“%d”,&day);
Printf(“\nenter the month:”);
Scanf(“%d”,&month);
Printf(“\nenter the year:”);
Scanf(“%d”,&year);
if((day>=1 && day<=31) && (month==1 || month==3|| month==5||month==7|| month==8||
month==10 month==12||) && (year>=1))
{
Printf(“The date entered is valid”);
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
flag=1;
}
else if((day>=1 && day<=30) && (month==4|| month==6|| month==9||month==11) &&
(year>=1))
{
Printf(“The date entered is valid”);
flag=1;
}
else if((day>=1 && day<=29) && (month=2) && (year>=1) && ((year%100==0
&&year%400==0) || (year>=1) && (year%100!==0 && year%4==0)))
{
Printf(“The date entered is valid”);
flag=1;
}
else if((day>=1 && day<=28) && (month==2) && (year>=1))
{
Printf(“The date entered is valid”);
flag=1;
}
Else
{
Printf(“\n The date is invalid”);
}
if(flag==1)
{
if(day>=2)
{
prev_day = -prev_day;
printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
}
else if(day==1)
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
{
if(month==1)
{
prev_day = 31;
prev_month = 12;
prev_year= -year;
printf(“\nTheprevious date is:%d%d%d”,&prev_day,&month,&year);
}
if(month==5||month==7|| month==10||month==12)
{
prev_day = 31;
prev_month = -month;
printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
}
Else if(month==2|| month==4|| month==6||month==8|| month==9|| month==11)
{
prev_day = 31;
prev_month = -month;
printf(“\nTheprevious date is:%d%d%d”,&prev_day,&month,&year);
elseif(month==3)
{
if((year%100==0 && year%400==0) || (year>=1) && (year%100!==0&& year%4==0))
{
prev_day = 29;
prev_month = -month;
printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
}
Else
{
prev_day = 28;
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
prev_month = -month;
Flow Table:
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Ex. No. – 06 Design the test cases for login page of AMIZONE.
Software used:
Manual testing
Procedure:
HOME PAGE:
Advertise rs
must
be
displayed
Click Advertise Link Terms Of design low
the service
page
must be
displayed
Click Terms Of Privacy design low
Membership Link Policy page
must be
displayed
Click Privacy Policy Link Privacy design low
Policy page
must be
displayed
Lblnk01 Verify To Verify Click NEW USERS Link New Users design low
Hyper the Hyper located in login box Registrati
links Links on Form
displayed must be
at Login displayed
Box on
login page
working
or not
Click New Users(Blue New Users design low
Color) Link located in login Registrati
box on Form
must be
displayed
ClickForgetPasswordLink Passwor d design medium
locatedinloginbox Retrieval
Page
must be
displayed
Conclusions:
Test cases have been formulated.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Given string str of alphanumeric characters, the task is to check whether the string is a
valid PAN (Permanent Account Number) Card number or not by using Regular
Expression.
The valid PAN Card number must satisfy the following conditions:
1. It should be ten characters long.
2. The first five characters should be any upper case alphabets.
3. The next four-characters should be any number from 0 to 9.
4. The last(tenth) character should be any upper case alphabet.
5. It should not contain any white spaces.
Examples:
Input: str = “BNZAA2318J”
Output: true
Explanation:
The given string satisfies all the above mentioned conditions.
Input: str = “23ZAABN18J”
Output: false
Explanation:
The given string not starts with upper case alphabets, therefore it is not a valid PAN Card
number.
Input: str = “BNZAA2318JM”
Output: false
Explanation:
The given string contains eleven characters, therefore it is not a valid PAN Card number.
Input: str = “BNZAA23184”
Output: true
Explanation:
The last(tenth) character of this string is a numeric(0-9) character, therefore it is not a valid
PAN Card number.
Input: str = “BNZAA 23184”
Output: true
Explanation:
The given string contains white spaces, therefore it is not a valid PAN Card number.
Approach: This problem can be solved by using Regular Expression.
Get the string.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Create a regular expression to validate the PAN Card number as mentioned below:
regex = "[A-Z]{5}[0-9]{4}[A-Z]{1}";
Where:
[A-Z]{5} represents the first five upper case alphabets which can be A to Z.
[0-9]{4} represents the four numbers which can be 0-9.
[A-Z]{1} represents the one upper case alphabet which can be A to Z.
Match the given string with the regex, in Java, this can be done
using Pattern.matcher().
Return true if the string matches with the given regex, else return false.
Program :
import java.util.regex.Matcher;
import java.util.regex.Pattern;
}
// Print the table
System.out.println(" ");
System.out.println("| PAN | Expected output | Actual output | Result |");
System.out.println("| | | | |");
for (int i = 0; i < PAN.size(); i++) {
System.out.printf("| %13s | %-5s | %-5s | %-4s |\n",PAN.get(i),
exp.get(i), actual.get(i), (exp.get(i).equals(actual.get(i))) ? "PASS" : "FAIL");
}
System.out.println(" ");
}
static boolean isValidPanCardNumber(String str){
String regex = "[A-Z]{5}[0-9]{4}[A-Z]{1}";
Pattern p = Pattern.compile(regex);
if(str == null)
{
return false;
}
Matcher m = p.matcher(str);
return m.matches();
}
}
Output:
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Software used:
Manual testing
Procedure:
An ATM card is swapped and checked for errors.
Con
7) tinu a) Yes 1) Entertheoptions 1) High
e b) No 2) Exit 2) High
tran
sact
ion
Conclusions:
Test cases have been formulated and ATM card has been tested.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
THEORY:
Rational Robot is a complete set of components for automating the testing of Microsoft
Windowsclient/server and Internet applications running under Windows NT 4.0, Windows
XP, Windows 2000, Windows 98, and Windows Me. The main component of Robot lets you
start recording tests in as few as two mouse clicks. After recording, Robot plays back the tests
in a fraction of the time it wouldtake to repeat the actions manually. Other components of
Robot are:
Rational Administrator – Use to create and manage Rational projects, which store your
testing information.
Rational TestManager Log – Use to review and analyze test results.
Object Properties, Text, Grid, and Image Comparators – Use to view and analyze
the results of verification point playback.
Rational SiteCheck – Use to manage Internet and intranet Web sites.
Step 2: On Admin Window right click on Project and enter Project name and Location.
Step 4: On a new Configuration Project Window under Test Assets click on Create
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Step 5: Select the Microsoft Access as the Database and click on next •> finish
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Step 6: In the Rational Administrator window click on Rational Robot Icon that is 10th from
right.
Step 7: After giving the name a GUI Record Window is displayed as follows
Step 8: You may now perform any function on the operating system and this GUI will record
each and every event that occurs.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
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.
Conclusion:
We understood all the steps needed to work on Rational Robot.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Ex. No. – 10 Write a script to record verification point using Rational Robot (For GUI
testing of single click on window OS).
THEORY:
When you record a GUI script, Robot records:
Your actions as you use the application-under-test. These user actions include
keystrokes and mouse clicks that help you navigate through the application.
Verification points that you insert to capture and save information about specific
objects. A verification point is a point in a script that you create to confirm the state of
an object across builds. During recording, the verification point captures object
information and stores it as the baseline. During playback, the verification point
recaptures the object information and compares it to the baseline.
The recorded GUI script establishes the baseline of expected behavior for the application-
under-test. When new builds of the application become available, you can play back the
script to test the builds against the established baseline in a fraction of the time that it would
take to perform the testing manually.
You should plan to use Robot at the earliest stages of the application development and
testing process. If any Windows GUI objects such as menus and dialog boxes exist within the
initial builds of your application, you can use Robot to record the corresponding verification
points.
Set up test environment Set recording options Perform user actions
Start recording End recording GUI Script Recording Workflow Create verification
points Before You Begin Recording
Consider the following guidelines before you begin recording:
Establish predictable start and end states for your scripts.
Set up your test environment.
Create modular scripts.
Create Shared Projects with UNC.
Rather than defining a long sequence of actions in one GUI script, you should define
scripts that are short and modular. Keep your scripts focused on a specific area of testing —
for example, on one dialog box or on a related set of recurring actions. When you need more
comprehensive testing, modular scripts can easily be called from or copied into other scripts.
They can also be grouped into shell scripts, which are top-level, ordered groups of scripts.
The benefits of modular scripts are:
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
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.
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.
Click ok.
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.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Suppose I leave it on order it button. Click ok. Then its properties will detect.
We can do modifications in the properties. After that click ok. It will come to normal windoe.
Now we have to run both of the script file. Click on playback script icon, that is displayed on
standard toolbar.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
A playback window will open. Where we have to choose our script1 file.
Click ok
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Click ok
12 result will display
Ex. No. – 11 Write a script to record verification point for Clip Board and alphanumeric
values using Rational Robot
THEORY:
A verification point is a point in a script that you create to confirm the state of an object
across builds of the application-under-test.
During recording, a verification point captures object information and stores it in a
baseline data file. The information in this file becomes the baseline of the expected state of
the object during subsequentbuilds.
Alphanumeric
Captures and tests alphanumeric data in Windows objects that contain text, such as edit
boxes, check boxes, group boxes, labels, push buttons, radio buttons, toolbars, and windows
(captions). You can use the verification point to verify that text has not changed, to catch
spelling errors, and to ensure that numeric values are accurate.
Clipboard
Captures and compares alphanumeric data that has been copied to the Clipboard. To use this
verification point, the application must supply a Copy or Cut capability so that you can place
the data on the Clipboard. This verification point is useful for capturing data from
spreadsheet and word processing applications as well as terminal emulators.
SOFTWARE TESTING AND QUALITY ASSURANCE BTDSE512N
Conclusion:
We checked the script and got the results in terms of pass/fail.