Sunteți pe pagina 1din 79

SRI SIVANI COLLEGE OF ENGINEERING

(Srikakulam, Etcherla Mandal, Chilakapalem, Andhra Pradesh 532402)

(Approved by AICTE, New Delhi, and Affiliated to Jawaharalal Nehru Technological University:
Kakinada(AP)

IV B. Tech., CSE I - Semester

LABORATORY MANUAL
For

SOFTWARE TESTING METHODOLOGY


Student Manual

Prepared by :

DR. JANMENJOY NAYAK, Associate Professor

DEPARTMENT OF

COMPUTER SCIENCE AND ENGINEERING


LAB TIME TABLE

DAY/ 09:10AM- 10:00AM- 10:50AM- 11:40PM- 12:30PM- 1:20PM- 2:10PM- 3:00PM-


TIME 10:00A.M 10:50A.M 11:40P.M 12:30P.M 1:20P.M 2:10P.M 3:00P.M 3:50P.M

MON
L
TUE STM LAB
U
WED N
C
THU STM LAB
H
FRI

SAT
GUIDELINES FOR STUDENTS:

1. Students should be regular and come prepared for the lab practice.
2. In case a student misses a class, it is his/her responsibility to complete that missed experiment(s).
3. Students should bring the observation book, lab journal and lab manual. Prescribed textbook and
class notes can be kept ready for reference if required.
4. They should implement the given Program individually.
5. While conducting the experiments students should see that their programs would meet the
following criteria:
 Programs should be interactive with appropriate prompt messages, error messages if any,
and descriptive messages for outputs.
 Programs should perform input validation (Data type, range error, etc.) and give appropriate
error messages and suggest corrective actions.
 Comments should be used to give the statement of the problem and every function should
indicate the purpose of the function, inputs and outputs
 Statements within the program should be properly indented
 Use meaningful names for variables and functions.
 Make use of Constants and type definitions wherever needed.

6. Once the experiment(s) get executed, they should show the program and results to the instructors
and copy the same in their observation book.
7. Questions for lab tests and exam need not necessarily be limited to the questions in the manual,
but could involve some variations and / or combinations of the questions.
LAB OBJECTIVES:

The Main Objective of this Lab are:

 To study fundamental concepts in software testing, including software testing objectives,


process, criteria, strategies, and methods.
 To discuss various software testing issues and solutions in software unit test; integration,
regression, and system testing.
 To learn how to planning a test project, design test cases and data, conduct testing operations,
manage software problems and defects, generate a testing report.
 To expose the advanced software testing topics, such as object-oriented software testing
methods, and component-based software testing issues, challenges, and solutions.
 To gain software testing experience by applying software testing knowledge and methods to
practice-oriented software testing projects.
 To understand software test automation problems and solutions.
 To learn how to write software testing documents, and communicate with engineers in various
forms.
 To gain the techniques and skills on how to use modern software testing tools to support
software testing projects.

SOFTWARE AND HARDWARE REQUIREMENTS:

Server System configuration:

8 GB RAM , 500 MB of free disk space, Win 2K3 server, Selenium tool, MS Access/Oracle
7.x,8.x,9/MS SQL

Server Client System configuration:

2 GB RAM , 10 MB of free disk space, Win XP, IE 6.0


DO’S:

 Turn off the system once you are done using it.
 Read and understand how to carry out an activity thoroughly before coming to laboratory.
 Know the location of the fire extinguisher and the first aid box and how to use them in case
of emergency.
 Report fires or accidents to your lecture/laboratory technician immediately.
 Report any broken plugs or exposed electrical wires to your lecture/laboratory technician
immediately.

DON’T ’S:

 Do not eat or drink in the laboratory.


 Don’t use pen drives in the laboratory.
 Do not install or download any software or modify or delete any system files on any lab
computers.
 Do not read or modify other user files.
 Respect the equipment & do not damage, remove, or disconnect any labels, parts, cables or
equipment.
IV Year – I SEMESTER

LIST OF EXPERMENTS

1. Consider an automated banking application. The user can dial the bank from a personal
computer, provide a six-digit password, and follow with a series of keyword commands that
activate the banking function. The software for the application accepts data in the following
form:

Design adhoc test cases to test the system.


2. Consider an automated banking application. The user can dial the bank from a personal
computer, provide a six-digit password, and follow with a series of keyword commands that
activate the banking function. The software for the application accepts data in the following
form:

Design the test cases to test the system using following Black Box testing technique:
BVA, Worst BVA, Robust BVA, Robust Worst BVA Equivalence class testing (Input/Output
domain).

3. Consider an application that is required to validate a number according to the following simple rules:
a. A number can start with an optional sign.
b. The optional sign can be followed by any number of digits.
c. The digits can be optionally followed by a decimal point, represented by a period.
d. If there is a decimal point, then there should be two digits after the decimal.
e. Any number-whether or not it has a decimal point, should be terminated a blank.
f. A number can start with an optional sign.
g. The optional sign can be followed by any number of digits.
h. The digits can be optionally followed by a decimal point, represented by a period.
i. If there is a decimal point, then there should be two digits after the decimal.
j. Any number-whether or not it has a decimal point, should be terminated a blank. Generate
test cases to test valid and invalid numbers.
(HINT) Use Decision table and cause-effect graph to generate test cases.
4. Generate test cases using Black box testing technique to Calculate Standard Deduction on
Taxable Income. The standard deduction is higher for tax payers who are 65 or older or
blind. Use the method given below to calculate tax.
1. The first factor that determines the standard deduction is the filing status. The basic
standard deduction for the various filing status are:
Single $4,750
Married, filing a joint return $9,500
Married, filing a separate return $7,000
2. If a married couple is filing separate returns and one spouse is not taking standard
Deduction, the other spouse also is not eligible for standard deduction.
3. An additional $1,000 is allowed as standard deduction, if either the filer is 65 yrs or the
spouse is 65 yrs or older (the latter case applicable when the filing status is “Married”
and filing “joint”).
4. An additional $1,000 is allowed as standard deduction, if either the filer is blind or the
spouse is blind (the latter case applicable when the filing status is “married” and filing
“joint”).

(HINT):
From the above description, it is clear that the calculation of standard deduction depends
on the following 3 factors:
1. Status of filing of the filer
2. Age of the filer
3. Whether the filer is blind or not
In addition, in certain cases, the following additional factors also come into play in
calculating the standard deduction.
1. Whether spouse has claimed standard deduction
2. Whether spouse is blind
3. Whether the spouse is more than 65 years old
5. Consider the following program segment:
1. int max (int i, int j, int k)
2. {
3. int max;
4. if (i>j) then
5. if (i>k) then max=i;
6. else max=k;
7. else if (j > k) max=j
8. else max=k
9. return (max);
10. }
a) Draw the control flow graph for this program segment.
b) Determine the cyclomatic complexity for this program.
c) Determine the independent paths.
6. Source code of simple insertion sort implementation using array in ascending order in c
programming language.
#include<stdio.h>
int main(){
int i,j,s,temp,a[20];
Printf ("Enter total elements: "); Scanf ("%d",&s);
printf("Enter %d elements: ",s); for(i=0;i<s;i++) scanf("%d",&a[i]); for(i=1;i<s;i++){
temp=a[i]; j=i-1; while((temp<a[j])&&(j>=0)){ a[j+1]=a[j];
j=j-1;
}
a[j+1]=temp;
}
printf("After sorting: ");
for(i=0;i<s;i++)
printf(" %d",a[i]);
return 0;
}
HINT: for loop is represented as while loop
a) Draw the program graph for given program segment b) Determine the DD path graph
c) Determine the independent paths
d) Generate the test cases for each independent path
7. Consider a system having an FSM for a stack having the following states and transitions:
States
Initial: Before creation
Empty: Number of elements = 0
Holding: Number of elements > 0, but less than the maximum capacity
Full: Number elements = maximum
Final: After destruction
Initial to Empty: Create
Empty to Holding, Empty to Full, Holding to Holding, Holding to Full: Add
Empty to Final, Full to Final, Holding to Final: Destroy
Holding to Empty, Full to Holding, Full to Empty: Delete
Design test cases for this FSM using state table-based testing.
8. Given the following fragment of code, how many tests are required for 100% decision coverage?
Give the test cases.
if width > length
then biggest_dimension = width if height > width
then biggest dimension = height end_if
else if biggest dimension = length then if height > length
then biggest_dimension = height end_if
end_if end_if
Hint 04 test cases
9. Given the following code, how much minimum number of test cases is required for full statement
and branch coverage?
read p read q
if p+q> 100
then print "Large" endif
if p > 50
then print "p Large" endif
Hint 1 test for statement coverage, 2 for branch coverage
10. Consider a program to input two numbers and print them in ascending order given below. Find
all du paths and identify those du-paths that are not feasible. Also find all dc paths and generate the
test cases for all paths (dc paths and non dc paths).
#include<stdio.h>
#include<conio.h>
1. void main ()
2. {
3 int a, b, t;
4. Clrscr ();
5. Printf (“Enter first number”);
6. scanf (“%d”,&a);
7. printf(“Enter second number”);
8. scanf(“%d”,&b);
9. if (a<b){
10. t=a;
11a=b;
12 b=t;
13}
14. printf (“%d %d”, a, b);
15 getch ();
}
11. Consider the above program and generate possible program slices for all variables. Design at
least one test case from every slice.
12. Consider the code to arrange the nos. in ascending order. Generate the test cases for relational
coverage, loop coverage and path testing. Check the adequacy of the test cases through mutation
testing and also compute the mutation score
for each.
i = 0;
n=4; //N-Number of nodes present in the graph
While (i<n-1) do j = i + 1;
While (j<n) do
if A[i]<A[j] then swap (A[i], A[j]); end do;
i=i+1;
end do
1. Study of any Web Testing Tool (Eg. Selenium)

PROCEDURE:
Selenium Introduction
Automation
Automation is making a process automatic eliminating the need for human intervention. It is a self-
controlling or self-moving process. Automation Software offers automation wizards and commands of its
own in addition to providing a task recording and re-play capabilities. Using these programs you can record
an IT or business task.

Benefits of Automation
 Fast
 Reliable
 Repeatable
 Programmable
 Reusable
 Makes Regression testing easy
 Enables 24*78 Testing
 Robust verification

History of Selenium
• In 2004 invented by Jason R. Huggins and team.
• Original name is JavaScript Functional Tester [JSFT]
• Open source browser based integration test framework built originally by Thought works.
• 100% JavaScript and HTML
• Web testing tool
• That supports testing Web 2.0 applications
• Supports for Cross-Browser Testing(ON Multiple Browsers)
• And multiple Operating Systems
• Cross browser – IE 6/7, Firefox .8+, Opera, Safari 2.0+

What is Selenium?
• Acceptance Testing tool for web-apps
• Tests run directly in browser
• Selenium can be deployed on Windows, Linux, and Macintosh.
• Implemented entirely using browser technologies -
 JavaScript
 DHTML
 Frames

Selenium Components
– Selenium IDE
– Selenium Core
– Selenium RC
– Selenium Grid
Selenium IDE
• The Selenium-IDE (Integrated Development Environment) is the tool you use to develop your Selenium
test cases.
• It is Firefox plug-in
• Firefox extension which allows record/play testing paradigm
• Automates commands, but asserts must be entered by hand
• Creates the simplest possible Locator
• Based on Selenese
Overview of Selenium IDE:
A.Test Case Pane
B. Toolbar
C.Menu Bar
D.Log/Reference/UI-Element/Rollup Pane

Menu Bar

The File menu has options for Test Case and Test Suite (suite of Test Cases). Using these you can add a new
Test Case, open a Test Case, save a Test Case, export Test Case in a language of your choice. You can also
open the recent Test Case. All these options are also available for Test Suite.

The Edit menu allows copy, paste, delete, undo, and select all operations for editing the commands in your
test case. The Options menu allows the changing of settings. You can set the timeout value for certain
commands, add user-defined user extensions to the base set of Selenium commands, and specify the format
(language) used when saving your test cases. The Help menu is the standard Firefox Help menu; only one
item on this menu–UI-Element Documentation–pertains to Selenium-IDE.

Toolbar

The toolbar contains buttons for controlling the execution of your test cases, including a step feature for
debugging your test cases. The right-most button, the one with the red-dot, is the record button.

Speed Control: controls how fast your test case runs.

Run All: Runs the entire test suite when a test suite with multiple test cases is loaded.

Run: Runs the currently selected test. When only a single test is loaded this button and the Run All button
have the same effect.

Pause/Resume: Allows stopping and re-starting of a running test case.

Step: Allows you to “step” through a test case by running it one command at a time. Use for debugging test
cases.

TestRunner Mode: Allows you to run the test case in a browser loaded with the Selenium-Core TestRunner.
The TestRunner is not commonly used now and is likely to be deprecated. This button is for evaluating test
cases for backwards compatibility with the TestRunner. Most users will probably not need this button.

Apply Rollup Rules: This advanced feature allows repetitive sequences of Selenium commands to be
grouped into a single action. Detailed documentation on rollup rules can be found in the UI-Element
Documentation on the Help menu.

Record: Records the user’s browser actions.

Test Case Pane

Your script is displayed in the test case pane. It has two tabs, one for displaying the command and their
parameters in a readable “table” format.
The other tab - Source displays the test case in the native format in which the file will be stored. By default,
this is HTML although it can be changed to a programming language such as Java or C#, or a scripting
language like Python. See the Options menu for details. The Source view also allows one to edit the test case
in its raw form, including copy, cut and paste operations.

The Command, Target, and Value entry fields display the currently selected command along with its
parameters. These are entry fields where you can modify the currently selected command. The first
parameter specified for a command in the Reference tab of the bottom pane always goes in the Target field.
If a second parameter is specified by the Reference tab, it always goes in the Value field.

If you start typing in the Command field, a drop-down list will be populated based on the first characters you
type; you can then select your desired command from the drop-down.

Log/Reference/UI-Element/Rollup Pane

The bottom pane is used for four different functions–Log, Reference, UI-Element, and Rollup–depending on
which tab is selected.

Log

When you run your test case, error messages and information messages showing the progress are displayed
in this pane automatically, even if you do not first select the Log tab. These messages are often useful for test
case debugging. Notice the Clear button for clearing the Log. Also notice the Info button is a drop-down
allowing selection of different levels of information to log.

Reference

The Reference tab is the default selection whenever you are entering or modifying Selenese commands and
parameters in Table mode. In Table mode, the Reference pane will display documentation on the current
command. When entering or modifying commands, whether from Table or Source mode, it is critically
important to ensure that the parameters specified in the Target and Value fields match those specified in the
parameter list in the Reference pane. The number of parameters provided must match the number specified,
the order of parameters provided must match the order specified, and the type of parameters provided must
match the type specified. If there is a mismatch in any of these three areas, the command will not run
correctly.

While the Reference tab is invaluable as a quick reference, it is still often necessary to consult the Selenium
Reference document.

UI-Element and Rollup

Detailed information on these two panes (which cover advanced features) can be found in the UI-Element
Documentation on the Help menu of Selenium-IDE.

Selenium Commands - “Selenese”


The command set is often called selenese. Selenium commands come in three “flavors”: Actions, Accessory
and Assertions.
a. Actions: user actions on application / Command the browser to do something.
Actions are commands that generally manipulate the state of the application.
1. Click link- click / Clickandwait
2. Selecting items
b. Accessors: Accessors examine the state of the application and store the results in variables, e.g.
"storeTitle".
c. Assertions: For validating the application we are using Assertions
1. For verifying the web pages
2. For verifying the text
3. For verifying alerts
Assertions can be used in 3 modes:
· assert
· verify
· waitFor
Example: "assertText","verifyText" and "waitForText".
NOTE:
1. When an "assert" fails, the test is aborted.
2. When a "verify" fails, the test will continue execution
3. "waitFor" commands wait for some condition to become true
Commonly Used Selenium Commands
These are probably the most commonly used commands for building test.
open - opens a page using a URL.
click/clickAndWait - performs a click operation, and optionally waits for a new page to load.
verifyTitle/assertTitle - verifies an expected page title.
verifyTextPresent- verifies expected text is somewhere on the page.
verifyElementPresent -verifies an expected UI element, as defined by its HTML tag, is present on the page.
verifyText - verifies expected text and it’s corresponding HTML tag are present on the page.
verifyTable - verifies a table’s expected contents.
waitForPageToLoad -pauses execution until an expected new page loads. Called automatically when
clickAndWait is used.
waitForElementPresent -pauses execution until an expected UI element, as defined by its HTML tag, is
present on the page.
Recording and Run settings
When Selenium-IDE is first opened, the record button is ON by default.
During recording, Selenium-IDE will automatically insert commands into your test case based on your
actions.
a. Remember Base URL MODE - Using Base URL to Run Test Cases in Different Domains
b. Record Absolute recording mode – Run Test Cases in Particular Domain.
Running Test Cases
Run a Test Case Click the Run button to run the currently displayed test case.
Run a Test Suite Click the Run All button to run all the test cases in the currently loaded test suite.
Stepping Through a Testcase
To execute a test case one command at a time (“step through” it), follow these steps:
1. Start the test case running with the Run button from the toolbar.

2. Immediately pause the executing test case with the Pause button.

3. Repeatedly select the Step button.

Stop and Start The Pause button can be used to stop the test case while it is running. The icon of this button
then changes to indicate the Resume button. To continue click Resume.
Stop in the Middle You can set a breakpoint in the test case to cause it to stop on a particular command. This
is useful for debugging your test case. To set a breakpoint, select a command, right-click, and from the
context menu select Toggle Breakpoint.
Start from the Middle You can tell the IDE to begin running from a specific command in the middle of the
test case. This also is used for debugging. To set a startpoint, select a command, right-click, and from the
context menu select Set/Clear Start Point.
Run Any Single Command Double-click any single command to run it by itself.
This is useful when writing a single command. It lets you immediately test a command you are constructing,
when you are not sure if it is correct. You can double-click it to see if it runs correctly. This is also available
from the context menu.
Test Suite:
A test suite is a collection of tests. Often one will run all the tests in a test suite as one continuous batch-job.
When using Selenium-IDE, test suites also can be defined using a simple HTML file. The syntax again is
simple. An HTML table defines a list of tests where each row defines the filesystem path to each test.

Some of the testing tools are:


Winrunner – Functional Testing Tool
Selenium -- Web Testing Tool
BugZilla, Bugbit – Bug tracking Tool
Test director – Test Management Tool
Test Link – Open Source Testing Tool
Loadrunner – Load/ Stress Testing Tool.
OUTPUT:
EXPERIMENT 1:

1. Consider an automated banking application. The user can dial the bank from a personal computer,
provide a six-digit password, and follow with a series of keyword commands that activate the
banking function. The software for the application accepts data in the following form:

Design Ad hoc test cases to test the system

Sample1.html
<html>
<head>
<script type="text/javascript">
function validation()
{

if(areavalidation())
{
if(prefixvalidation())
{
if(suffixvalidation())
{
if(passvalidation())
{
if(commandvalidation())
{
}
}
}
}

}
return false;
}

function passvalidation()
{
var a = document.form.pass.value;

var paswd= /^(?=.*[0-9])(?=.*[!@#$%^&*])(?=.*[a-z])[a-zA-Z0-9!@#$%^&*]{6}$/;


if(a=="")
{
alert("Please Enter Your Password");
document.form.pass.focus();
return false;
}

if(a.match(paswd))
{
//alert("Correct, try another...") ;
return true;
}
else
{
alert("Wrong...! password should contain atleast one loweralphabet,one number,one specialcharacterand
length 6");
return false;
}
}

function suffixvalidation()
{
var b = document.form.suffix.value;

var numbers = /^[0-9]{4}$/;


if(b.match(numbers))
{
//alert(" suffix matched");

return true;
}
else
{
alert("Please suffixinput numeric characters only of length 4");

return false;
}

function areavalidation()
{

var c = document.form.area.value;
if(c.length==3)
{

var numbers1 = /^[0-9]{3}$/;


if(c.match(numbers1))
{
//alert("true number are three digits");

return true;
}
else
{
alert("only enter numbers for area");
return false ;
}

}
else if(c.length<=0)
{
//alert(" u entered blank area code");
return true;
}

else
{
alert("area should be either balnk or three digit number");
return false;
}
}

function prefixvalidation()
{
var d = document.form.prefix.value;

var numbers2 = /^[2-9]\d{2}$/;


if(d.match(numbers2))
{
//alert(" prfix matched");

return true;
}
else
{
alert("Please prefixinput numeric characters only of length 3 and not begin with 0 or 1");

return false;
}
}

function commandvalidation()
{
if( document.form.command.value == "-1" )
{
alert( "Please provide your command!" );
return false;
}
window.location = "main.html";
return true;
}

</script>
</head>
<body>
<form name="form" method="post" onsubmit="return validation()">

<tr>
<td> AreaCode:</td>
<td><input type="text" name="area""></td>
</tr>
<tr>
<td> prefix:</td>
<td><input type="text" name="prefix""></td>
</tr>
<tr>
<td> suffix:</td>
<td><input type="text" name="suffix""></td>
</tr>
<tr>
<td> password:</td>
<td><input type="text" name="pass""></td>
</tr>
<tr>
<td align="right">command</td>
<td>
<select name="command">
<option value="-1" selected>[choose yours]</option>
<option value="1">checkstatus</option>
<option value="2">deposit</option>
<option value="3">withdrawal</option>
</select>
</td>
</tr>
<tr>

<td><input type="submit" name="sub" value="Submit"></td>


</tr>
</form>
</body>
</html>

main.html:
<html>
<body>
<p>
hii</p>
</body>
</html>

TEST CASES:
Test case 1: Areacode Blank

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

LOG:

[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=prefix | |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please prefixinput numeric characters only of length 3 and not begin
with 0 or 1 | |
 [info] Test case passed
 [info] Test suite completed: 1 played, all passed!

Test case 2: AREACODE THREEDIGIT:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

Log:
[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=prefix | |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please prefixinput numeric characters only of length 3 and not begin
with 0 or 1 | |
 [info] Test case passed
 [info] Test suite completed: 1 played, all passed!

Test case 3: AREACODE VIALATION:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>1234</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>area should be either balnk or three digit number</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
LOG:
[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=prefix | |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please prefixinput numeric characters only of length 3 and not begin
with 0 or 1 | |
 [info] Test case passed
 [info] Test suite completed: 1 played, all passed!

Test case 4: PREFIXSHOULD NOT BE NULL


?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>123</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
Log:
[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=prefix | |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please prefixinput numeric characters only of length 3 and not begin
with 0 or 1 | |
 [info] Test case passed
 [info] Test suite completed: 1 played, all passed!

Test case 5: PREFIX SHOULD NOT BE START WITH 0 AND 1:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>012</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>123</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
LOG:
[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=prefix | |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please prefixinput numeric characters only of length 3 and not begin
with 0 or 1 | |
 [info] Test case passed
 [info] Test suite completed: 1 played, all passed!

Test case 6: PREFIX THREEDIGIT NUMBER AND SUFFIX NOT NULL:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>1234</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>234</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

LOG:
[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=prefix | |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please prefixinput numeric characters only of length 3 and not begin
with 0 or 1 | |
 [info] Test case passed
 [info] Test suite completed: 1 played, all passed!

Test case 7: SUFFIX THREE DIGIT NOT VALID & ONLY 4 DIGIT&PASSWORD NOT NULL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>123</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>1234</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please Enter Your Password</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

Test case 8: WITH OUT PREFIX VALUE GIVE SUFFIX VALUE 123:TEST SUTE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>123</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>1234</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please Enter Your Password</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
Log:
[info] Playing test case Untitled

 [info] Executing: |open | file:///home/aliet/sample.html | |


 [info] Executing: |type | name=suffix | 123 |
 [info] Executing: |click | name=sub | |
 [info] Executing: |assertAlert | Please suffixinput numeric characters only of length 4 | |
 [error] Actual value 'Please prefixinput numeric characters only of length 3 and not begin with 0 or 1'
did not match 'Please suffixinput numeric characters only of length 4'
 [info] Test case failed
 [info] Test suite completed: 1 played, 1 failed
Test case 9: password Test failed conditions:

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=pass</td>
<td>1234</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Wrong...! password should contain atleast one loweralphabet,one number,one
specialcharacterand length 6</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=pass</td>
<td>asdfggh</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Wrong...! password should contain atleast one loweralphabet,one number,one
specialcharacterand length 6</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=pass</td>
<td>12as</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Wrong...! password should contain atleast one loweralphabet,one number,one
specialcharacterand length 6</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=pass</td>
<td>12as#</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Wrong...! password should contain atleast one loweralphabet,one number,one
specialcharacterand length 6</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
Test case 10: provide at least one command and command sucessful:

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please provide your command!</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=command</td>
<td>label=checkstatus</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=sub</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

screenshots:
EXPERIMENT 2:

Consider an automated banking application. The user can dial the bank from a personal computer,
provide a six-digit password, and follow with a series of keyword commands that activate the banking
function. The software for the application accepts data in the following form:

Design the test cases to test the system using following Black Box testing technique:
BVA, Worst BVA, Robust BVA, Robust Worst BVA, Equivalence class testing (Input/Output domain)
DESCRIPTION:

It is a Black Box testing/ Functional/Behavioral Testing technique

Objective of any Test Cases is to have max coverage and capability to discover more and more
errors.

Boundary Value Checking(BVC):



Test cases are designed by holding one variable at its extreme value and other variables at their
nominal values in the input domain. The variable at its extreme value can be selected at:
1. Minimum value (Min)
2. Value just above the minimum value (Min+ )
3. Maximum value (Max)
4. Value just below the maximum value (Max-)
Boundary Value Checking


Number of test cases generated in Boundary Value Analysis (BVA) for ‘n’ input variables is 4n+1.

Test cases for two input variables are 4(2)+1=9
1. Anom, Bmin
2. Anom, Bmin+
3. Anom, Bmax
4. Anom, Bmax-
5. Amin, Bnom
6. Amin+, Bnom
7. Amax, Bnom
8. Amax-, Bnom
9. Anom, Bnom

Robustness Testing Method:



When test cases are designed considering above points in addition to BVC, it is called Robustness
testing. Instead of considering above two extra variables are also considered they are
A value just greater than the Maximum value (Max+)
A value just less than Minimum value (Min-)

Number of test cases generated in Robust BVA for ‘n’ input variables is 6n+1

The number of test cases for two input variables is 6(2)+1=13
1. Anom, Bmin
2. Anom, Bmin+
3. Anom, Bmax
4. Anom, Bmax-
5. Amin, Bnom
6. Amin+, Bnom
7. Amax, Bnom
8. Amax-, Bnom
9. Anom, Bnom
10. Amax+, Bnom
11. Amin-, Bnom
12. Anom, Bmax+
13. Anom, Bmin-

Worest Case Testing method



When more than one variable are in extreme values, i.e. when more than one variable are on the
boundary. It is called Worst case testing method.

Number of test cases generated in Worst Case BVA for ‘n’ input variables is 5n

The number of test cases for 2 input variables is 52 =25 as shown below.
PROCEDURE:

Given problem is

Area code : Blank or 3 digit number


Prefix : 3 digit number, not starting with 0 or 1
Suffix : 4 digit number
Password : 6 characters alphanumeric
Commands : “Check status”,”Deposit”,”Withdrawal”

# AREA CODE -

Input Range is [ 100 - 999 ]

Boundary Value Analysis (BVA)

Number of test cases generated in Boundary Value Analysis (BVA) for ‘n’ input variables is
= 4n+1
= 4(1)+1 [ Here, input variable is ‘1’ ]
=5

Test Cases for single input variable using BVC are


min = 100
min+ = 101
max = 999
max- = 998
nominal value = 500-555

Test Suite is

Test Case ID Input Value Expected Output


1 100 Valid Area code
2 101 Valid Area code
3 999 Valid Area code
4 998 Valid Area code
5 553 Valid Area code

TESTCASE:

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>100</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>101</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>99</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>area should be either balnk or three digit number</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>999</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>1000</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>area should be either balnk or three digit number</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=area</td>
<td>555</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>200</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
Robust BVAMethod

Number of test cases generated in Robust BVA for ‘n’ input variables is
= 6n+1
= 6(1)+1 [ Here, input variable is ‘1’ ]
= 7

Test Cases for single input variable using Robust BVC are

min = 100
min- = 99
min+ = 101
max = 999
max- = 998
max+ = 1000
nominal value = 500-555

Test Suite is

Test Case ID Input Value Expected Output


1 100 Valid Area code
2 99 Invalid Area code
3 101 Valid Area code
4 999 Valid Area code
5 1000 Invalid Area code
6 998 Valid Area code
7 553 Valid Area code
Worst Case BVA:

Number of test cases generated in Worst Case BVA for ‘n’ input variables is
= 5n
= 51 [ Here, input variable is ‘1’ ]
= 5
Test cases in a Test Suite are same as that of BVC

# PREFIX -

Input Range is [ 200 – 999 ]


Boundary Value Analysis (BVA)

Number of test cases generated in Boundary Value Analysis (BVA) for ‘n’ input variables is
= 4n+1
= 4(1)+1 [ Here, input variable is ‘1’ ]
=5
Test Cases for single input variable using BVC are
min = 200
min+ = 201
max = 999
max- = 998
nominal value = 500-555
Test Suite is
Test Case ID Input Value Expected Output
1 200 Valid Prefix
2 201 Valid Prefix
3 999 Valid Prefix
4 998 Valid Prefix
5 553 Valid Prefix

Robust BVA Method

Number of test cases generated in Robust BVA for ‘n’ input variables is
= 6n+1
= 6(1)+1 [ Here, input variable is ‘1’ ]
= 7

Test Cases for single input variable using Robust BVC are

min = 200
min- = 199
min+ = 201
max = 999
max- = 998
max+ = 1000
nominal value = 500-555

Total number of Test Cases in Test Suite is

Test Case ID Input Value Expected Output


1 200 Valid Prefix
2 199 Invalid Prefix
3 201 Valid Prefix
4 999 Valid Prefix
5 1000 Invalid Prefix
6 998 Valid Prefix
7 553 Valid Prefix

Worst Case BVA:

Number of test cases generated in Worst Case BVA for ‘n’ input variables is
= 5n
= 51 [ Here, input variable is ‘1’ ]
= 5

Test cases are same as that of BVC

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>200</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>201</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>999</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>1000</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>023</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=prefix</td>
<td>123</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please prefixinput numeric characters only of length 3 and not begin with 0 or 1</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>
# SUFFIXFIX -

Input Range is [ 1000 to 9999 ]

Boundary Value Analysis (BVA)

Number of test cases generated in Boundary Value Analysis (BVA) for ‘n’ input variables is
= 4n+1
= 4(1)+1 [ Here, number of input input variable i.e n=1 ]
=5

Test Cases for single input variable using BVC are

min = 1000
min+ = 1001
max = 9999
max- = 9998
nominal = 5000-5555

Total number of Test Cases in Test Suite is

Test Case ID Input Value Expected Output


1 1000 Valid Suffixfix
2 1001 Valid Suffixfix
3 9999 Valid Suffixfix
4 9998 Valid Suffixfix
5 5553 Valid Suffixfix
Robust BVA Method

Number of test cases generated in Robust BVA for ‘n’ input variables is
= 6n+1
= 6(1)+1 [ Here, input variable is ‘1’ ]
= 7

Test Cases for single input variable using Robust BVC are

min = 1000
min- = 999
min+ = 1001
max = 9999
max- = 9998
max+ = 10000
nominal value = 5000-5555

The Test Suite is

TestCase ID Input Value Expected Output


1 1000 Valid Suffixfix
2 999 Invalid Suffixfix
3 1001 Valid Suffixfix
4 9999 Valid Suffixfix
5 10000 Invalid Suffixfix
6 9998 Valid Suffixfix
7 5553 Valid Suffixfix

Worst Case BVA:

Number of test cases generated in Worst Case BVA for ‘n’ input variables is
= 5n
= 51 [ Here, input variable is ‘1’ ]
= 5

Test cases are same as that of BVC.

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="file:///home/aliet/sample.html" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>file:///home/aliet/sample.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>1000</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please Enter Your Password</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>9999</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please Enter Your Password</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>10000</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>999</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>555</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please suffixinput numeric characters only of length 4</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=suffix</td>
<td>5555</td>
</tr>
<tr>
<td>click</td>
<td>name=sub</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Please Enter Your Password</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

# PASSWORDWORD

Input Range is [ 0 to 9 ] , [ a to z ] , [A to Z ],[!@#$%^&*]

Boundary Value Analysis (BVA)

Number of test cases generated in Boundary Value Analysis (BVA) for ‘n’ input variables is
= 4n+1
= 4(1)+1 [ Here, input variable is ‘1’ ]
=5

Test Cases for single input variable using BVA are

Test Case /Attribute [0–9] [a–b] [A–B]


min 000000 aaaaaa AAAAAA
max 999999 zzzzzz ZZZZZZ
min+ 000001 bbbbbb BBBBBB
max- 999998 yyyyyy YYYYYY
nominal 500000 mmmmmm MMMMMM
Total number of Test Cases in Test Suite for the range [0-9] is

Test Case ID Input Value Expected Output


1 000000 Valid Password
2 999999 Valid Password
3 999998 Valid Password
4 000001 Valid Password
5 500000 Valid Password

The Test Suite for the range [a-z] is

Test Case ID Input Value Expected Output


1 aaaaaa Valid Password
2 zzzzzz Valid Password
3 bbbbbb Valid Password
4 yyyyyy Valid Password
5 mmmmmm Valid Password

The Test Suite for the range [A-Z] is

Test Case ID Input Value Expected Output


1 AAAAAA Valid Password
2 ZZZZZZ Valid Password
3 BBBBBB Valid Password
4 YYYYYY Valid Password
5 MMMMMM Valid Password

Robust BVAMethod

Number of test cases generated in Robust BVA for ‘n’ input variables is
= 6n+1
= 6(1)+1 [ Here, input variable is ‘1’ ]
= 7

Test Cases for single input variable using Robust BVC are

Test Case /Attribute [0–9] [a–b] [A–B]


min 000000 aaaaaa AAAAAA
max 999999 zzzzzz ZZZZZZ
min+ 000001 bbbbbb BBBBBB
max- 999998 yyyyyy YYYYYY
nominal 500000 mmmmmm MMMMMM
min- ////// `````` @@@@@@
max+ :::::: {{{{{{ $$$$$$

Total number of Test Cases in Test Suite for the range [0-9] is

Test Case ID Input Value Expected Output


1 000000 Valid Password
2 999999 Valid Password
3 999998 Valid Password
Test Case ID Input Value Expected Output
4 000001 Valid Password
5 500000 Valid Password
6 ////// Invalid Password
7 :::::: Invalid Password

The Test Suite for the range [a-z] is

Test Case ID Input Value Expected Output


1 aaaaaa Valid Password
2 zzzzzz Valid Password
3 bbbbbb Valid Password
4 yyyyyy Valid Password
5 mmmmmm Valid Password
6 `````` Invalid Password
7 {{{{{{ Invalid Password

The Test Suite for the range [A-Z] is

Test Case ID Input Value Expected Output


1 AAAAAA Valid Password
2 ZZZZZZ Valid Password
3 BBBBBB Valid Password
4 YYYYYY Valid Password
5 MMMMMM Valid Password
6 @@@@@@ Invalid Password
7 $$$$$$ Invalid Password

Worst Case BVA:

Number of test cases generated in Worst Case BVA for ‘n’ input variables is
= 5n
= 51 [ Here, input variable is ‘1’ ]
= 5

Test cases are same as that of BVC

command:

InputRage:[checkstatus,deposit,withdrawal]
Testcaseid Inputvalue expectedOutput
1 checkstatus Valid command
2 deposit Valid command
3 withdrawal Valid command
4 chooseoption Invalid command
# EQUIVALENCE CLASSES

DESCRIPTION:

Equivalence partitioning testing is a software testing technique which divides the application input test data
into each partition at least once of equivalent data from which test cases can be derived as shown in the
below diagram. By this testing method it reduces the time required for software testing.

Constraints used for Equivalence class generation are

If input Variable is Number of Valid Classes Number of Invalid Classes


Range 1 2
Specific Value 1 2
Member in a set 1 1
Boolean 1 1

PROCEDURE:

The number of Classes generated using Equivalence class technique for the given problem is

S.No. Valid/Invalid Equivalence Classes


1 Valid I1:{<AREA CODE, Prefix, Suffix, Password, Commands>:Area Code=Blank }
2 Invalid I2:{<AREA CODE, Prefix, Suffix, Password, Commands>:Area Code is other than
blank/3 digit}
3 Valid I3:{<AREA CODE, Prefix, Suffix, Password, Commands>:Prefix is 3 dig & not
starting with 0/1}
4 Invalid I4:{<AREA CODE, Prefix, Suffix, Password, Commands>:Prefix starts with either
1/0}
5 Valid I5:{<AREA CODE, Prefix, Suffix, Password, Commands>:Suffix is a 4 digit no}
6 Invalid I6:{<AREA CODE, Prefix, Suffix, Password, Commands>:Suffix < 4 digit no}
7 Invalid I7:{<AREA CODE, Prefix, Suffix, Password, Commands>:Suffix> 4 digits}
8 Valid I8:{<AREA CODE, Prefix, Suffix, Password, Commands>:Password is 6 chars &
alphanumeric}
9 Invalid I9:{<AREA CODE, Prefix, Suffix, Password, Commands>:Password < 6 chars}
10 Invalid I10:{<AREA CODE, Prefix, Suffix, Password, Commands>:Password > 6 chars}
11 Invalid I11:{<AREA CODE, Prefix, Suffix, Password, Commands>:Password is other than
alphanumeric}
12 Invalid I12:{<AREA CODE, Prefix, Suffix, Password, Commands>:Prefix < 3digits}
13 Invalid I13:{<AREA CODE, Prefix, Suffix, Password, Commands>:Prefix > 3 digits}
14 Valid I14:{<AREA CODE, Prefix, Suffix, Password, Commands>:Commands is “Check”,
”Deposit”, ”Withdrawal”}
15 Invalid I15:{<AREA CODE, Prefix, Suffix, Password, Commands>:Commands is other than
“Check”, ”Deposit”, ”Withdrawal”}
16 Invalid I16:{<AREA CODE, Prefix, Suffix, Password, Commands>:Area Code < 3 digits}
17 Invalid I17:{<AREA CODE, Prefix, Suffix, Password, Commands>:Area Code > 3 digits}
18 Valid I18:{<AREA CODE, Prefix, Suffix, Password, Commands>:Area Code = 3 digits}
EXPERIMENT 3:
Consider an application that is required to validate a number according to the following simple rules:

1. A number can start with an optional sign.


2. The optional sign can be followed by any number of digits.
3. The digits can be optionally followed by a decimal point, represented by a period.
4. If there is a decimal point, then there should be two digits after the decimal.
5. Any number-whether or not it has a decimal point, should be terminated a blank.
Generate test cases to test valid SSSSand invalid numbers.
(HINT) Use Decision table and cause-effect graph to generate test cases.
EXPERIMENT 4:

Aim:
Generate test cases using Black box testing technique to Calculate Standard Deduction on Taxable
Income. The

standard deduction is higher for tax payers who are 65 or older or blind. Use the method given below to
calculate tax.

1. The first factor that determines the standard deduction is the filing status. The basic standard deduction for
the various filing status are:

Single $4,750
Married, filing a joint return $9,500
Married, filing a separate return $7,000

2. If a married couple is filing separate returns and one spouse is not taking standard Deduction, the other
spouse also is not eligible for standard deduction.

3. An additional $1,000 is allowed as standard deduction, if either the filer is 65 yrs or the spouse is 65 yrs or
older(the latter case applicable when the filing status is “Married” and filing “joint”).

4. An additional $1,000 is allowed as standard deduction, if either the filer is blind or the spouse is blind (the
latter case applicable when the filing status is “married” and filing “joint”).
(HINT):

From the above description, it is clear that the calculation of standard deduction depends on the following 3
factors:
1. Status of filing of the filer
2. Age of the filer
3. Whether the filer is blind or not

In addition, in certain cases, the following additional factors also come into play in calculating the standard
deduction.
1. Whether spouse has claimed standard deduction
2. Whether spouse is blind
3. Whether the spouse is more than 65 years old

Source Code:
import java.util.Scanner;

public class IncomeCalculator{

public static void main(String[] args){

final double TAX_RATE = 0.20;

Scanner reader = new Scanner(System.in);

double grossIncome;
int numApplicants;
double taxableIncome;
double STANDARD_DEDUCTION=0;
double incomeTax;
String status;
String accstatus;
String ph;
String sd;
int age1,age2;

System.out.print("Enter the gross income: ");


grossIncome = reader.nextDouble();

System.out.print("Enter the number of applicants: ");


numApplicants = reader.nextInt();

System.out.print("Enter the status single/married: ");


status = reader.next();

if(status.equals("single"))
{
STANDARD_DEDUCTION = 4750.0;
System.out.println(STANDARD_DEDUCTION);
}

else
{
System.out.print("Enter the account status joint/separate: ");
accstatus = reader.next();

if(accstatus.equals("joint"))
{

System.out.print("Enter the age of applicant1 : ");


age1 = reader.nextInt();

System.out.print("Enter the age of applicant2 : ");


age2 = reader.nextInt();

System.out.print("\n Enter ph status if blind yes/no: ");


ph = reader.next();

if(age1>65 || age2>65 || ph.equals("yes"))


{
STANDARD_DEDUCTION = 10500.0;
System.out.println(STANDARD_DEDUCTION);
}
else
{
STANDARD_DEDUCTION = 9500.0;
System.out.println(STANDARD_DEDUCTION);
}
}
else{
System.out.print("spouse's sd yes/no: ");
sd = reader.next();
if(sd.equals("yes"))
{
STANDARD_DEDUCTION = 7000.0;
System.out.println(STANDARD_DEDUCTION);
}
else{
STANDARD_DEDUCTION = 0.0;
System.out.println(STANDARD_DEDUCTION);
}
}
}

taxableIncome = grossIncome - STANDARD_DEDUCTION * numApplicants;

incomeTax = taxableIncome * TAX_RATE;

System.out.println("The income tax is $" + incomeTax);


}
}

Output
Test case 1:
Tax payer is single

Input Expected output Output Remarks

Test case 2:
Tax payer is married, filing separate returns, spouse is taking standard deduction

Input Expected output Output Remarks

Test case 3:
Tax payer is married, filing separate returns, spouse is not taking standard deduction

Input Expected output Output Remarks

Test case 4:
Tax payer is married, filing joint returns, filer’s age>65

Input Expected output Output Remarks

Test case 5:
Tax payer is married, filing joint returns, spouse’s age>65

Input Expected output Output Remarks

Test case 6:
Tax payer is married, filing joint returns, filer/spouse age is not greater than 65

Input Expected output Output Remarks


Test case 7:
Tax payer is married, filing joint returns, filer is blind

Input Expected output Output Remarks

Test case 8:
Tax payer is married, filing joint returns, spouse is blind

Input Expected output Output Remarks

Test case 9:
Tax payer is married, filing joint returns, filer is blind

Input Expected output Output Remarks

Test case 10:


Tax payer is married, filing joint returns, spouse is blind

Input Expected output Output Remarks


EXPERIMENT 05 :

Consider the following program segment:


1. int max (int i, int j, int k)
2. {
3. int max;
4. if (i>j) then
5. if (i>k) then max=i;
6. else max=k;
7. else if (j > k) max=j
8. else max=k
9. return (max);
10. }
a) Draw the control flow graph for this program segment
b) Determine the cyclomatic complexity for this program
c) Determine the independent paths

Solution:

a)Draw the control flow graph for this program segment

b) Determine the cyclomatic complexity for this program

Cyclomatic Complexity:

V(G) = E - N + 2
Where,

E - Number of edges

N - Number of Nodes
From the above graph,
No. Of edges (E)=12
No. Of nodes(N)=10
Cyclomatic Complexity = E-N+2
=12-10+2
=4

c)Determine the independent paths:

Paths:
1) 0-1-2-3-8-9
2) 0-1-2-4-8-9
3) 0-1-5-6-8-9
4) 0-1-5-7-8-9
EXPERIMENT 06 :

Source code of simple insertion sort implementation using array in ascending order in c programming
language
#include<stdio.h>
int main()
{
int i,j,s,temp,a[20];
Printf ("Enter total elements: ");
Scanf ("%d",&s);
printf("Enter %d elements: ",s);
for(i=0;i<s;i++)
scanf("%d",&a[i]);
for(i=1;i<s;i++)
{
temp=a[i];
j=i-1;
while((temp<a[j])&&(j>=0))
{
a[j+1]=a[j];
j=j-1;
}
a[j+1]=temp;
}
printf("After sorting: ");
for(i=0;i<s;i++)
printf(" %d",a[i]);
return 0;
}
HINT: for loop is represented as while loop
a) Draw the program graph for given program segment
b) Determine the DD path graph
c) Determine the independent paths
d) Generate the test cases for each independent path
Solution:

a) Draw the program graph for given program segment


b) Determine the DD path graph

c) Determine the independent paths


Paths:
1) 1-2-4-9-12
2) 1-2-3-2-4-5-6-7-6-8-9-12
3) 1-2-3-2-4-5-6-7-8-5-9-12
4) 1-2-3-2-5-6-7-6-8-5-9-10-11-12
d) Generate the test cases for each independent path

Input Expected Output Original Status


Output
Value of n If n=0 or any integer accepted
(Here n is size of value
array) If n value is not Raise exception Raise eliminated
integer exception
or a -ve value
Elements of an array If elements are not Raise exception Raise
integers exception
if number of elements Raise exception Raise
exceeds the size of exception
the array or
EXPERIMENT 07 :

Consider a system having an FSM for a stack having the following states and transitions:
States
Initial: Before creation
Empty: Number of elements = 0
Holding: Number of elements > 0, but less than the maximum capacity
Full: Number elements = maximum
Final: After destruction
Initial to Empty: Create
Empty to Holding, Empty to Full, Holding to Holding, Holding to Full: Add
Empty to Final, Full to Final, Holding to Final: Destroy
Holding to Empty, Full to Holding, Full to Empty: Delete

Design test cases for this FSM using state table-based testing.

Tests Create Add Delete Destroy


s1)Input s2 - - -
s2)Empty - s3,s4 - s5
s3)Holding - S3,s4 s2 s5
s4)Full S2,s3 s5
s5)Final - - - -
EXPERIMENT 8 :

Given the following fragment of code, how many tests are required for 100% decision
coverage? Give the test cases.

if width > length


then biggest_dimension = width if height > width
then biggest dimension = height end_if
else if biggest dimension = length then if height > length
then biggest_dimension = height end_if
end_if end_if

Source Code:
import java.util.Scanner;

public class BiggestDimension{

public static void main(String[] args){

Scanner reader = new Scanner(System.in);

double width;
double length;
double height;
double bigdimension;

System.out.println("Enter the height: ");


height = reader.nextDouble();

System.out.println("Enter the width: ");


width= reader.nextDouble();

System.out.println("Enter the length: ");


length =reader.nextDouble();

if(width > length)


{
if(width > height)
{
bigdimension = width;
}
else
{
bigdimension= height;
}
}
else
{
if(length > height)
{
bigdimension = length;
}
else
{
bigdimension= height;
}
}
System.out.println(bigdimension);
}
}

Output:
Test case1: width>length && Width>height

INPUT OUTPUT EXPECTED OUTPUT STATUS

L=6,w=9,h=5 9 9 success

Test case 2: width>length && Height >Width

INPUT OUTPUT EXPECTED OUTPUT STATUS

L=12, w=15, h=22 22 22 success

Test case3: width<length && length>height

INPUT OUTPUT EXPECTED OUTPUT STATUS

L=82, w=76, h=78 82 82 success

Test case 4: width<length && length<height

INPUT OUTPUT EXPECTED OUTPUT STATUS

L=8, w=6, h=15 15 15 success


EXPERIMENT 9:

Given the following code, how much minimum number of test cases is required for full
statement and branch coverage?

read p read q
if p+q> 100
then print "Large" endif
if p > 50
then print "p Large" endif
Hint 1 test for statement coverage, 2 for branch coverage

Solution:
Statement Coverage:
In this the test case is executed in such a way that every statement of the code is executed at least
once.

Branch/Decision Coverage:
Test coverage criteria requires enough test cases such that each condition in a decision takes on all
possible outcomes at least once, and each point of entry to a program or subroutine is invoked at
least once. That is, every branch (decision) taken each way, true and false. It helps in validating all
the branches in the code making sure that no branch leads to abnormal behavior of the application

Path Coverage:
In this the test case is executed in such a way that every path is executed at least once. All possible
control paths taken, including all loop paths taken zero, once, and multiple (ideally, maximum)
items in path coverage technique, the test cases are prepared based on the logical complexity
measure of a procedural design. In this type of testing every statement in the program is guaranteed
to be executed at least one time. Flow Graph, Cyclomatic Complexity and Graph Metrics are used
to arrive at basis path

How to calculate Statement Coverage, Branch Coverage and Path Coverage?


Draw the flow in the following way-
-Nodes represent entries, exits, decisions and each statement of code.
- Edges represent non-branching and branching links between nodes.

Example:
Read P
Read Q
IF P+Q > 100 THEN
Print “Large”
ENDIF
If P > 50 THEN
Print “P Large”
ENDIF
Statement Coverage (SC):
To calculate Statement Coverage, find out the shortest number of paths following which all
the nodes will be covered. Here by traversing through path 1A-2C-3D-E-4G-5H all the nodes are
covered. So by traveling through only one path all the nodes 12345 are covered, so the Statement
coverage in this case is 1.
Branch Coverage (BC):
To calculate Branch Coverage, find out the minimum number of paths which will ensure
covering of all the edges. In this case there is no single path which will ensure coverage of all the
edges at one go. By following paths 1A-2C-3D-E-4G-5H, maximum numbers of edges (A, C, D, E,
G and H) are covered but edges B and F are left. To covers these edges we 3 www.ajoysinigha.info
can follow 1A-2B-E-4F. By the combining the above two paths we can ensure of traveling through
all the paths. Hence Branch Coverage is 2. The aim is to cover all possible true/false decisions.
Path Coverage (PC):
Path Coverage ensures covering of all the paths from start to end.
All possible paths are-
1A-2B-E-4F
1A-2B-E-4G-5H
1A-2C-3D-E-4G-5H
1A-2C-3D-E-4F
So path coverage is 4.
Thus for the above example SC=1, BC=2 and PC=4.

S-ar putea să vă placă și