Stqa File
Stqa File
Stqa File
ShriVaishnavVidhyapeethVishwavidyalaya
Shri Vaishnav Institute of Information Technology
DepartmentofComputer ScienceEngineering
LABFILE
CODE:BTDSE512N
III-year/V-Semester–Section(C)
Enrollmentno: 21100BTCSE09899
CONTENTS
S. No. Experiment Page no. Remarks
EXPERIMENT-1
AIM: Design test cases using boundary value analysis by taking quadratic equation problem
PROCEDURE: Write a program for the determination of the nature of roots of a quadratic equation. Its
input is a triple of positive integers and value may be from interval [0,200]. The program output will be:
CODE:
import java.lang.*;
import java.util.*;
public class Experiment_1
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the value of a, b, c: \t");
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (d > 0) {
System.out.println("Roots are real and distinct");
System.out.println("First root is: " + root1);
System.out.println("Second root is: " + root2);
} else if (d < 0) {
System.out.println("Roots are imaginary");
} else {
System.out.println("Roots are same");
System.out.println("First root is: " + root1);
System.out.println("Second root is: " + root2);}
}
}
}
}
TEST CASES:
OUTPUT:
EXPERIMENT-2
AIM: Design test cases using equivalence class partitioning taking triangle problem
PROCEDURE: A triangle can be classified based on the lengths of its sides into three main types:
CODE:
import java.util.Scanner;
public class Experiment_2
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the three sides of the triangle: \t");
double x = sc.nextDouble();
double y = sc.nextDouble();
double z = sc.nextDouble();
TEST CASES:
OUTPUT:
EXPERIMENT-3
AIM: Design test cases using Decision table taking triangle problem
PROCEDURE:A decision table is a good way to deal with different combination inputs with their associated
outputs and also called cause-effect table. The reason to call cause-effect table is an associated logical diagramming
technique called cause-effect graphing that is basically use to derive the decision table. Decision table testing is a
black box test design technique to determine the test scenarios for complex business logic.
CODE:
import java.util.Scanner;
public class Experiment_3
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the three sides of the triangle: \t");
double x = sc.nextDouble();
double y = sc.nextDouble();
double z = sc.nextDouble();
if ((x + y) < z)
{
System.out.println("Not a triangle");
}
else if (x <= 0 || y <= 0 || z <= 0 || x > 199 || y > 199 || z > 199)
{
System.out.println("Impossible");
}
else
{
if (x == y && y == z)
System.out.println("Equilateral triangle");
else if (x == y && y != z || y == z && z != x || x == z && x != y)
System.out.println("Isosceles triangle");
else if (x != y && y != z && x != z)
System.out.println("Scalene triangle");
}
}
}
Decision Table:
TEST CASES:
OUTPUT:
EXPERIMENT-4
AIM: Design independent paths by calculating cyclometer complexity using date problem
PROCEDURE: Cyclomatic complexity is a software metric used to indicate the complexity of a program. It
is a quantitative measure of the number of linearly independent paths through a program's source code. It
gives the maximum number of independent paths in a program. Two alternate methods are available for the
complexity calculations:
2. Cyclomatic Complexity V(G) of a flow graph is equal to the number of predicate (decision) nodes plus
one.
V(G) = pi + 1
where,
pi is the number of predicate nodes contained in the flow graph.
CODE:
import java.util.Scanner;
public class Experiment_4 {
int date;
int month;
int year;
int dayCount = 0;
int dayNumber = 0;
int dayMonth = 0;
if (countDigit(year) != 4)
System.out.println("Invalid year"); return;
if (isLeap(year)) {
switch (month) {
case 1: dayMonth = 0; break;
case 2: dayMonth = 31; break;
case 3: dayMonth = 60; break;
case 4: dayMonth = 91; break;
case 5: dayMonth = 121; break;
case 6: dayMonth = 152; break;
case 7: dayMonth = 182; break;
case 8: dayMonth = 213; break;
case 9: dayMonth = 244; break;
case 10: dayMonth = 274; break;
case 11: dayMonth = 305; break;
case 12: dayMonth = 335; break;
}
} else {
switch (month) {
case 1: dayMonth = 0; break;
case 2: dayMonth = 31; break;
case 3: dayMonth = 59; break;
case 4: dayMonth = 90; break;
case 5: dayMonth = 120; break;
case 6: dayMonth = 151; break;
case 7: dayMonth = 181; break;
case 8: dayMonth = 212; break;
case 9: dayMonth = 243; break;
case 10: dayMonth = 273; break;
case 11: dayMonth = 304; break;
case 12: dayMonth = 334; break;
}
}
TEST CASES:
OUTPUT:
EXPERIMENT-5
PROCEDURE: Give the present date in the form of a triplet of day, month and year. To check whether the date
given is valid or invalid. If valid then the output Is previous date.
CODE:
import java.util.Scanner;
public class Experiment_5 {
TEST CASES:
OUTPUT:
EXPERIMENT-6
AIM: Design the test cases for the login page for AMIZONE
PROCEDURE: Open the web browser and paste the given url in the address bar. Home page must be
displayed.
EXPERIMENT-7
PROCEDURE; A PAN card number is taken as input and is checked for errors.
CODE:
import java.lang.*;
import java.util.*;
if (panCard.length() == 10)
{
if (isUpperCase(panCard))
{
if (panCard.matches("[A-Z]{5}[0-9]{4}[A-Z]{1}"))
{
System.out.println("Valid PAN number");
} else
{
TEST CASES:
OUTPUT:
OBSERVATION
Test Expected
Case Name Description Steps Result Priority
1 1st 5 characters Verify if all are i) Characters are numerical Invalid! Medium
alphabets in capital
ii) Characters are
alphanumeric Invalid!
iii) Special characters
entered (including space) Invalid!
iv) All alphabets (small) Invalid!
v) All alphabets (capital) Valid! High
Verify if next 4
2 Next 4 characters characters are numerals i) Characters are alphabets Invalid! Medium
ii) Invalid!
alphanumeric Invalid!
iii) Valid!
entered (including space)
iv)
High
EXPERIMENT-8
OBSERVATION:
b)After3attempts,cardg
etsblocked
b) ValidPIN 2) Bankingoptions 2) High
3) Balanceenquir a) Savingaccount 1)MinRs.10,000/- 1) High
y b) Currentaccount 2)MinRs.1000/- 2) High
4) Cashwithdrawl a) Enteramount 1) a)Cashnotavaila 1) Low
bleb)Cashavaila
ble
b) Incorrectamount 2) a)Enteramountinmultipl 2) a)High
eof100's. b)Low
b)Tryagain
5) Statementrecei a) Ministatement Listing 1) High
pt b) Wantareceipt Yes 2) a)High
No b) Low
Conti
7) nue a) Yes 1) Entertheoptions 1) High
transa b) No 2) Exit 2) High
ction
EXPERIMENT- 9
THEORY:Rational Robot is a complete set of components for automating the testing of Microsoft
Windows client/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 would take 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 Test Manager 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.
We use the Rational Administrator to create and manage projects. Rational projects store application testing
information, such as scripts, verification points, queries, and defects. Each project consists of a database and
several directories of files. All Rational Test components on your computer update and retrieve data from
the same active project. Projects help you organize your testing information and resources for easy tracking.
Projects are created in the Rational Administrator, usually by someone with administrator privileges.
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
Step 5: Select the Microsoft Access as the Database and click on next •> finish
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.
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 understand all the steps needed to work with the rational robot.
EXPERIMENT- 10
AIM: Write a script to record verification points 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
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
14. if we want to test object properties, select it, then 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.
Suppose I leave it on order it button. Click ok. Then its properties will be detected.
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.
A playback window will open. Where we have to choose our script1 file.
Click ok
Click ok
12.resultst will display