STL Final Record
STL Final Record
23
Create test plan document for library
26/10/2022
8 management system
27
9 09/11/2022 Pytest Installation
29
10 09/11/2022 Pytest program for Addition
30
11 09/11/2022 Pytest program for Sum of Digits
31
12 09/11/2022 Pytest program for Fibonacci Series
32
13 16/11/2022 Study of Selenium Web Testing Tool
1
Exp.NO: 01 Write programs in Python Language to demonstrate the working of
followingconstructs with possible test cases: a) do…while b) while…do c)
Date:14/09/22
if …else d) switch e) for
Aim:
To write python programs for do…while, while, for, switch and if…else and test with possible test
cases.
Algorithm:
1. Start the program.
2. Create separate files for each given program.
3. Write simple program for each construct.
4. Test the program with possible test cases.
5. Stop the program.
Programs:
i.)do…while:
def display():
start=input("Enter a positive value for START: ")
end=input("Enter a positive value for END: ")
if start.isnumeric() and end.isnumeric():
while True:
start=int(start)
end=int(end)
print(start,end=‘ ‘)
if start<end:
start+=1
else:
break
else:
print("Enter a valid positive number.")
display()
Output:
i. Positive numbers
Enter a positive value for START: 1
Enter a positive value for END: 4
1234
ii.) while…do
Output:
i. Positive numbers
Enter a positive value for START: 1
Enter a positive value for END: 4
1234
3
iii.) switch
def switch():
switcher={
0:"even",
1:"odd"
}
n=input('Enter a value for N: ') try:
n=int(n)
print(switcher[n%2])
except ValueError:
print("Enter a valid number.")
switch()
Output:
i. Positive numbers
Enter a value for N: 1
odd
iv.) if else
def compare():
a=input("Enter a value for A: ")
b=input("Enter a value for B: ")
try:
a=int(a)
b=int(b)
if a>b:
print("A is greater than")
elif a<b:
print("B is greater than")
else:
print("A is equal to B")
except ValueError:
print(“Enter a valid number.”)
4
Output:
i. Positive numbers
Enter a value for A: 1
Enter a value for B: 1
A is equal to B.
v.) for
def iterate():
string=input("Enter a string: ")
for i in string:
print(ord(i),end=" ")
iterate()
Output:
i. Characters
Enter a string: say
115 97 121
ii. Number
Enter a string: 1543
49 53 52 51
Result:
Thus, the python program to demonstrate the working of given constructs is implemented and the
output is verified successfully.
5
Exp.NO: 02
Write a program in Python language for Matrix multiplication fails. Introspect
Date:14/09/22 the causes for its failure and write down the possible reasons for its failure.
Aim:
Write a python program for matrix multiplication and inspect for failures.
Algorithm:
1. Start the program.
2. Create empty list formatrix1, matrix2 and result.
3. Get the rows and columns count from the user.
4. Get the values of two matrix.
5. Perform matrix multiplication and store the answer in result.
6. Stop the program.
Program:
r1,c1=input("enter row and column count in matrix 1: ").split()
r2,c2=input("enter row and column count in matrix 2: ").split()
matrix1=[ ]
matrix2=[ ]
result=[ ]
6
for i in range(r1):
inter=[]
for j in range(c2):
sum=0
for k in range(r2):
sum += matrix1[i][k] * matrix2[k][j]
inter.append(sum)
result.append(inter)
for i in range(r1):
for j in range(c2):
print(result[i][j],end=" ")
print()
else:
print("enter a valid number")
Output:
FAILURE CASES:
1. Enter the size of a: 2 3
Enter the size of b: 2 3
Matrix multiplication is not possible.
Reason to fail: to do multiplication of matrices the number of columns in matrix ―a[] should be
equal to the number of rows in matrix in b[]
7
4. Enter the size of a: 350 480
Enter the size of b: 480 620
Matrix multiplication is not possible.
Reason to fail: size of buffer will be not be sufficient to handle this multiplication.
Result:
Thus, the python program for matrix multiplication is implemented and the causes
for its failure is introspected successfully.
8
Exp.NO: 03
Date:21/09/22
BINARY SEARCH
Aim:
Write a python program for Binary Search and inspect for failures.
Algorithm:
1. Start the program.
2. Get the list from the user
3. Get the element to be searched
4. Compare the mid element with the key, if same return the index
5. If key is greater, search it in the right side, else search it in the left side.
6. If not found return -1
6. Stop the program.
Program:
def binary_search(arr, x):
low = 0
high = len(arr) - 1
mid = 0
while low <= high:
mid = (high + low) // 2
if arr[mid] < x:
low = mid + 1
elif arr[mid] > x:
high = mid – 1
else:
return mid
return -1
arr = [ 2, 3, 4, 10, 40 ]
x = input(“Enter the element to be searched: ”);
try:
x = int(x)
result = binary_search(arr, x)
if result != -1:
print("Element is present at index", str(result))
else:
print("Element is not present in array")
except:
print(“Enter a valid input!”)
9
Output:
1. Enter the element to be searched: 10
Element is present at index 3
2. Enter the element to be searched: -5
Element is not present in array
3. Enter the element to be searched: str
Enter a valid input!
4. Enter the element to be searched:
Enter a valid input!
Result:
Thus, the python program of binary search is implemented and the output is verified successfully.
10
Exp.NO: 04
Date:21/09/22
PALINDROME
AIM:
To write a Python program for checking Palindrome and to write test cases for ir.
ALGORITHM:
Step 1: Start
Step 2: Get an input from the user by prompting
Step 3: Run a loop form 0 to len/2.
Step 4: Check if the characters are the same both from the start and the end till len/2.
Step 5: If it is, return the result that it is a palindrome.
Step 6: Else, return that it is not a palindrome.
Step 7: Stop.
PROGRAM:
def Palindrome(string):
for i in range(0, int(len(string)/2)):
if(string[i]!=string[len(string)-i-1]):
return False
return True
s = input()
c=1
for i in s:
if not(i.isalpha()):
c=0
if(c==0):
print("Enter a valid string")
answer = Palindrome(s)
if(answer == True):
print("The given string is a palindrome")
else:
print("The given string is not a palindrome")
11
OUTPUT:
Alphanumeric values:
Input: S010S
Output: Enter a valid string
Test case : Fail
Numeric values:
Input: 12321
Output: Enter a valid string
Test case : Fail
Alphabet values:
Input: madam
Output: It is a palindrome
Test case : Pass
Non-palindrome string
Input: abcd
Output: It is not a palindrome
Test case: Pass
Symbols
Input: &%&
Output: Enter a valid string
Test case: Fail
RESULT:
Thus, a program to check palindrome has been written and test cases have been written and verified.
12
Exp.NO: 05
Date:21/09/22
SORTING
Aim:
Write a python program for sorting and inspect for failures.
Algorithm:
1. Start the program.
2. Get the number of elements from user
3. Get the elements to be sorted
4. Traverse the array and sort the elements one by one
5. Print the sorted array
6. Stop the program.
Program:
n - int(input("Enter the number of elements:"))
arr=[]
try:
print("Enter elements:")
for i in range(n):
a = int(input())
arr.append(a)
for i in range(n):
for j in range(i+1,n):
if (arr[i]>arr[j]):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
print("The array after sorting:")
for i in range(n):
print(arr[i])
except ValueError:
print("Enter a valid number.")
Output:
(i) Positive numbers:
Enter the number of elements:3
Enter the elements:
9
7
3
The array after sorting:
3
7
9
13
Enter the number of elements:3
Enter the elements:
-5
-6
-1
The array after sorting:
-6
-5
-1
(vii) Float:
Enter the number of elements:3
Enter the elements:
0.5
Enter a valid number.
RESULT:
Thus, a program to check sorting has been written and test cases have been written and verified
14
Exp.NO: 06
Date:12/10/22 Take ATM system and study its system specifications and report various bugs
Purpose:
This document describes the software requirements and specification (SRS) for an automated
teller machine (ATM) network. The document is intended for the customer and the developer
(designers, testers, maintainers). The reader is assumed to have basic knowledge of banking
accounts and account services. Knowledge and understanding of Unified Modeling Language
(UML) diagrams is also required.
Scope:
The software supports a computerized banking network called ‗Bank24„. The network
enables customers to complete simple bank account services via automated teller machines
(ATMs) that may be located off premise and that need not be owned and operated by the
customer’s bank. The ATM identifies a customer by a cash card and password. It collects
information about a simple account transaction (e.g., deposit, withdrawal, transfer, bill
payment), communicates the transaction information to the customer’s bank, and dispenses
cash to the customer. The banks provide their own software for their own computers. The
‗Bank24„ software requires appropriate record keeping and security provisions. The software
must handle concurrent accesses to the same account correctly.
Intended Audience:
Product Perspective:
15
Product functions:
Using an ATM, customers can access their bank accounts in order to make cash withdrawals
(or credit
card cash advances) and check their account balances. The functions of the system are:
1. Login
2. Get Balance Information
3. Withdraw Cash
4. Transfer Funds
Operating Environments:
The hardware, software and technology used should have following specifications:
□ Ability to read the ATM card.
□ Ability to count the currency notes.
□ Touch screen for convenience.
□ Keypad(in case touchpad fails)
□ Continuous power supply.
□ Ability to connect to bank’s network.
□ Ability to validate user.
Design/implementation constraints:
Login:
16
Lock Account
□ If number of consecutive unsuccessful logins exceeds three attempts, lock account.
Maintain Consecutive Unsuccessful Login Counter
Increment Login Counter
For every consecutive Login attempt, increment logic counter by 1.
Reset login counter to 0 after login is successful.
Get Balance Information
Withdraw Cash
Transfer Funds
User interfaces
The customer user interface should be intuitive, such that 99.9% of all new ATM users are able to
complete their banking transactions without any assistance.
Hardware interfaces
The hardware should have following specifications:
□ Ability to read the ATM card
□ Ability to count the currency notes
□ Touch screen for convenience
□ Keypad (in case touchpad fails)
□ Continuous power supply
□ Ability to connect to bank’s network
□ Ability to take input from user
□ Ability to validate user
Software interfaces
The software interfaces are specific to the target banking software systems. At present, two known
banking systems will participate in the ATM network.
□ State Bank
□ Indian Overseas Bank
Safety requirements:
Must be safe kept in physical aspects, say in a cabin
□ Must be bolted to floor to prevent any kind of theft
□ Must have an emergency phone outside the cabin
□ There must be an emergency phone just outside the cabin
□ The cabin door must have an ATM card swipe slot
□ The cabin door will always be locked, which will open only when user swipes his/her
ATM card in the slot & is validated as genuine
17
Security requirements:
□ Users accessibility is censured in all the ways
□ Users are advised to change their PIN on first use
□ Users are advised not to tell their PIN to anyone
□ The maximum number of attempts to enter PIN will be three
Result:
Thus, the ATM system specifications and reporting the various bugs is implemented and output
is verified successfully.
18
Exp.NO: 07
Date: 19/10/22 Test cases for banking applications
Banking applications are considered to be one of the most complex applications in today’s
software development and testing industry. What makes Banking application so complex?
What approach should be followed in order to test the complex workflows involved? In this
article we will be highlighting different stages and techniques involved in testing Banking
applications.
The above listed ten points are the most important characteristics of a Banking
application.
Banking applications have multiple tiers involved in performing an operation. For Example, a
banking application may have:
1. Web Server to interact with end users via Browser
2. Middle Tier to validate the input and output for web server
3. Data Base to store data and procedures
4. Transaction Processor which could be a large capacity Mainframe or any other
Legacy system to carry out Trillions of transactions per second.
Typical stages involved in testing Banking Applications are shown in below workflow
which we will be discussing individually.
19
1) Requirement Gathering:
2) Requirement Review:
In this stage QA Engineers derive Business Scenarios from the requirement documents
(Functions Specs or Use Cases); Business Scenarios are derived in such a way that all
Business Requirements are covered. Business Scenarios are high level scenarios without any
detailed steps, further these Business Scenarios are reviewed by Business Analyst to ensure
all of Business Requirements are met and its easier for BAs to review high level scenarios
than reviewing low level detailed Test Cases.
20
4) Functional Testing:
In this stage functional testing is performed and the usual software testing activities are
performed such as:
5) Database Testing:
Banking Application involves complex transaction which are performed both at UI level and
Database level, Therefore Database testing is as important as functional testing. Database in
itself is an entirely separate layer hence it is carried out by database specialists and it uses
techniques like
□ Data loading
□ Database Migration
□ Testing DB Schema and Data types
□ Rules Testing
□ Testing Stored Procedures and Functions
□ Testing Triggers
□ Data Integrity
6) Security Testing:
Security Testing is usually the last stage in the testing cycle as completing functional and non
functional are entry criteria to commence Security testing. Security testing is one of the major
stages in the entire Application testing cycle as this stage ensures that application complies
with Federal and Industry standards. Security testing cycle makes sure the application does
not have any web vulnerability which may expose sensitive data to an intruder or an attacker
and complies with standards like OWASP.
In this stage the major task involves in the whole application scan which is carried out using
tools like IBM Appscan or HP WebInspect (2 Most popular tools).
Once the Scan is complete the Scan Report is published out of which False Positives are
filtered out and rest of the vulnerability are reported to Development team for fixing
depending on the Severity.
Other Manual tools for Security Testing used are: Paros Proxy, Http Watch, Burp Suite,
Fortify tools Etc.
Apart from the above stages there might be different stages involved like Integration Testing
and Performance Testing.
In today’s scenario majority of Banking Projects are using: Agile/Scrum, RUP and
Continuous Integration methodologies, and Tools packages like Microsoft’s VSTS and
Rational Tools. As we mentioned RUP above, RUP stands for Rational Unified
Process, which is an iterative software development methodology introduced by IBM
which comprises of four phases in which development and testing activities are carried
21
out.
Four phases are:
i) Inception
ii)Collaboration
iii)Construction and
iii)Transition
Type of account
- Savings account
-Salary account
-Joint account
- Current account
- Secondary account
-RD account
-Account for a company
Test cases
-Checking mandatory input parameters
-Checking optional input parameters
-Check whether able to create account entity.
-Check whether you are able to deposit an amount in the newly created account (and thus updating
the balance)
-Check whether you are able to withdraw an amount in the newly created account (after
deposit) (and thus updating the balance)
-Check whether company name and its pan number and other details are provided in case ofsalary
account
-Check whether primary account number is provided in case of secondary account
-Check whether company details are provided in cases of company's current account
-Check whether proofs for joint account is provided in case of joint account
-Check whether you are able deposit an account in the name of either of the person in a joint
Result:
Thus, the Test cases for Banking Application is implemented and output is verified successfully.
22
Exp.NO: 08
Date:26/10/22 Test plan document for library application
The Library Management System is an online application for assisting a librarian in managing a
book library in a university. The system would provide basic set of features to add/update clients,
add/update books, search for books, and manage check-in / checkout processes. Our test group
tested the system based on the requirement specification.
INTRODUCTION
This test report is the result for testing in the LMS. It mainly focuses on two problems: what
we will test and how we will test.
Result
GUI test
Pass criteria: librarians could use this GUI to interface with the backend library database
without any difficulties
Result: pass
Database test
Pass criteria: Results of all basic and advanced operations are normal (refer to section 4)
Result: pass
23
Add a book
Pass criteria:
□ Each book shall have following attributes: Call Number, ISBN, Title, Author
name.
Result: pass
□ The retrieved book information should contain the four attributes.
Result: pass
Update/delete book
Pass criteria:
□ The book item can be retrieved using the call number
Result: did not pass. Cannot redrive using the call number
□ The data items which can be updated are: ISBN, Title, Author name Result: pass
□ The book can be deleted only if no user has issued it.
Result: partially pass. When no user has issued it, pass. When there
are user having issued it, did not pass
□ The updated values would be reflected if the same call number is called for Result:
pass
□ If book were deleted, it would not appear in further search queries. Result: pass
Pass criteria:
□ The product shall let Librarian query books„ detail information by their
ISBN number or Author or Title.
Result: pass
□ The search results would produce a list of books, which match the
search parameters with following Details: Call number, ISBN
number, Title, Author
Result: pass
□ The display would also provide the number of copies which is available for issue
Result: pass
□ The display shall provide a means to select one or more rows to a user-list Result:
pass
□ A detailed view of each book should provide information about check-
in/check out status, with the borrower’s information.
Result: pass
□ The search display will be restricted to 20 results per page and there
would be means to navigate from sets of search results.
Result: pass
□ The user can perform multiple searches before finally selecting a set
of books for check in or checkout. These should be stored across
searches.
Result: pass
□ A book may have more than one copy. But every copy with the same
ISBN number should have same detail information.
Result: pass
□ The borrower’s list should agree with the data in student’s account Result: pass
24
Check-in book
Pass criteria:
□ Librarians can check in a book using its call number
Result: pass
□ The check-in can be initiated from a previous search operation where
user has selected a set of books.
Result: pass
□ The return date would automatically reflect the current
system date. Result: did not pass.
□ Any late fees would be computed as difference between due date and
return date at rate of 10 cents a day.
Result: did not pass
□ A book, which has been checked in once, should not be checked in again Result:
pass
Check-out book
Pass criteria:
□ Librarians can check out a book using its call number Result: pass
□ The checkout can be initiated from a previous search operation where user has selected a set of
books.
Result: pass
□ The student ID who is issuing the book would be entered Result: pass
□ The issue date would automatically reflect the current system date. Result: did not pass
□ The due date would automatically be stamped as 5 days from current date. Result: did not pass
□ A book, which has been checked out once, should not be checked out again
Result: pass
□ A student who has books due should not be allowed to check out any books
Result: did not pass
□ The max. No of books that can be issued to a customer would be 10. The system should not
allow checkout of books beyond this limit.
Result: pass View book detail Pass criteria:
□ This view would display details about a selected book from search operation
Result: pass
□ The details to be displayed are: Call number, IBN, Title, Author, Issue status (In library or
checked out), If book is checked out it would display, User ID & Name, Checkout date, Due
date
Result: for checkout date and due date, did not pass
□ Books checked in should not display user summary
Result: pass
□ Books checked out should display correct user details. Result: pass
25
View student detail Pass criteria:
□ Librarians can select a user record for detailed view Result: pass
□ The detail view should show:
Network test
Pass criteria: Results of operations (ping, ftp and ODBC connectivity check) are normal
Result: did not test this item, because no enough machines and no available environment.
Result:
Thus, the Test cases for library application is implemented and output is verified successfully.
26
Exp.NO: 09
Date:09/11/22 Pytest Installation
Aim:
To install Pytest and to write test cases for a program and to test using Pytest.
Pytest:
It is a testing framework that allows users to write test codes using python programming
language. It helps you to write simple and scalable test case for databases, API’s or UI. Pytest
is mainly used for writing tests from simple unit tests to complex functional tests.
Procedure:
Installation on Windows:
1) Navigate to folder where the python is installed.
2) Open scripts folder and copy the address location.
3) Open command prompt and execute “cd copied_address_Location”.
4) Execute “pip install pytest”.
Creating File:
1) The file to be tested should have name as test_*.py or *_test.py
2) File should be located in the same folder where pytest module is installed
Terminologies in Pytest:
F – Failed
. – Passed
S – Skipped
X – xpassed
x – xfailed
Eg:
Parameterized Addition Program:
import pytest
@pytest.mark.parameterize(“input1, input2, output”,[(5,5,10),(3,5,12)])
27
Output:
Result:
Thus, we have installed pytest, implemented and executed a parameterized addition
program and the output is verified successfully.
28
Exp.NO: 10
Date:09/11/22 Pytest Python program for Addition
Aim:
To write a python program for addition of two numbers and test the test cases using Pytest.
Algorithm:
Program:
def add(a,b):
return a+b
def test_3_plus_5_equals_8():
assert add(3,5) == 8
def test_2_plus_3_equals_5():
assert add(2,3) == 6
Output:
Result:
Thus, the python program for addition is tested using pytest and executed and output is
verified successfully.
29
Exp.NO: 11
Date:09/11/22 Pytest Python program for Sum of Digits
Aim:
To write a python program for sum of digits and test the test cases using Pytest.
Algorithm:
Program:
def sumOfDigits(n):
sum = 0
while (n != 0):
sum = sum + int(n % 10)
n = int(n/10)
return sum
def test_1():
assert sumOfDigits(123) == 6
def test_2():
assert sumOfDigits(256) == 2
Output:
Result:
Thus, the python program for sum of digits is tested using pytest and executed and
output is verified successfully.
30
Exp.NO: 12
Date:09/11/22 Pytest Python program for Fibonacci Series
Aim:
To write a python program for Fibonacci Series and test the test cases using Pytest.
Algorithm:
Program:
def fibR(n):
if n==1 or n==2:
return 1
return fibR(n-1)+fibR(n-2)
def test_fib_1_equals_1():
assert fibR(1) == 1
def test_fib_2_equals_1():
assert fibR(2) == 1
def test_fib_6_equals_8():
assert fibR(6) == 7
Output:
Result:
Thus, the python program for Fibonacci Series is tested using pytest and executed and
output is verified successfully.
31
Exp.NO: 13
Date:16 Study of Selenium Web Testing Tool
What is Selenium?
JavaScript framework that runs in your web browser Works anywhere JavaScript is supported
Hooks for many other languages Java, Ruby, Python Can simulate a user navigating through
pages and then assert for specific marks on the pages All you need to really know is HTML to
start using it right away
Selenium IDE
Selenium Integrated Development Environment (IDE) is a Firefox plugin that lets testers to
record their actions as they follow the workflow that they need to test.
It provides a Graphical User Interface for recording user actions using Firefox which is used
to learn and use Selenium, but it can only be used with Firefox browser as other browsers
are not supported.
However, the recorded scripts can be converted into various programming languages
supported by Selenium and the scripts can be executed on other browsers as well.
Selenium-IDEDownload
Step 1 − Launch Firefox and navigate to the following URL - http://seleniumhq.org/download/.
Under the Selenium IDE section, click on the link that shows the current version number as
shown below.
Step 2 − Firefox add-ons notifier pops up with allow and disallow options. User has to allow theinstallation.
32
Step 3 − The add-ons installer warns the user about untrusted add-ons. Click 'Install Now'.
Step 4 − The Selenium IDE can now be accessed by navigating to Tools >>Selenium IDE.
Step 5 − The Selenium IDE can also be accessed directly from the quick access
menu bar as shown below.
The following image shows the features of Selenium IDE with the help of a simple tool-tip.
27
The features of the record tool bar are explained below.
28
Creating Selenium IDE Tests
This section deals with how to create IDE tests using
Step 2 − Open Selenium IDE from the Tools menu and press the record button
that is on the top- right corner.
Step 3 − Navigate to "Math Calculator" >> "Percent Calculator >> enter "10" as
number1 and 50 as number2 and click "calculate".
29
Step 4 − User can then insert a checkpoint by right clicking on the webelement and
select "Show all available commands" >> select "assert text css=b 5"
Step 5 − The recorded script is generated and the script is displayed as shown below.
SavingtheRecordedTest
Step 1 − Save the Test Case by navigating to "File" >> "Save Test" and save the
file in the location of your choice. The file is saved as .HTML as default.
The test can also be saved with an extension htm, shtml, and xhtml.
30
SavingtheTestSuite
A test suite is a collection of tests that can be executed as a single entity.
Step 1 − Create a test suite by navigating to "File" >> "New Test Suite" as shown below.
Step 2 − The tests can be recorded one by one by choosing the option "New Test
Case" from the "File" Menu.
31
Step 3 − The individual tests are saved with a name along
with saving a "Test Suite".
ExecutingtheRecordedTest
The recorded scripts can then be executed either by clicking "Play entire suite" or "Play current test"
button in the toolbar.
Step 1 − The Run status can be seen in the status pane that displays the number of tests passed and failed.
Step 2 − Once a step is executed, the user can see the result in the "Log" Pane.
Step 3 − After executing each step, the background of the test step turns "Green" if passed and "Red" if
failed as shown below.
32
Debugging is the process of finding and fixing errors in the test script. It is a common step in any script
development. To make the process more robust, we can make use a plugin "Power Debugger" for Selenium IDE.
Step 2 − Now launch 'Selenium IDE' and you will notice a new icon, "Pause on Fail"
on recording toolbar as shown below. Click it to turn it ON. Upon clicking again, it
would be turned "OFF".
Step 3 − Users can turn "pause on fail" on or off any time even when the test is running.
Step 4 − Once the test case pauses due to a failed step, you can use the resume/step
buttons to continue the test execution. The execution will NOT be paused if the failure
is on the last command of any test case.
Step 5 − We can also use breakpoints to understand what exactly happens during the
step. To insert a breakpoint on a particular step, "Right Click" and select "Toggle
Breakpoint" from the context- sensitive menu.
33
Step 6 − Upon inserting the breakpoint, the particular step is displayed with a
pause icon as shown below.
Step 7 − When we execute the script, the script execution is paused where the
breakpoint is inserted. This will help the user to evaluate the value/presence of an
element when the execution is inprogress.
34
Inserting Verification Points
This section describes how to insert verification points in Selenium IDE.
The test cases that we develop also need to check the properties of a web page. It requires assert and
verify commands. There are two ways to insert verification points into the script.
To insert a verification point in recording mode, "Right click" on the element and choose "Show all
Available Commands" as shown below.
We can also insert a command by performing a "Right-Click" and choosing "Insert New
Command".
35
After inserting a new command, click 'Command' dropdown and select appropriate
verification point from the available list of commands as shown below.
Given below are the mostly used verification commands that help us check if a
particular step has passed or failed.
verifyElementPresent
assertElementPresent
verifyElementNotPresent
assertElementNotPresent
verifyText
assertText
verifyAttribute
assertAttribute
verifyChecked
assertChecked
36
verifyAlert
assertAlert
verifyTitle
assertTitle
SynchronizationPoints
During script execution, the application might respond based on server load, hence it is
required for
the application and script to be in sync. Given below are few a commands that we can use to
ensure that the script and application are in sync.
waitForAlertNotPresent
waitForAlertPresent
waitForElementPresent
waitForElementNotPresent
waitForTextPresent
waitForTextNotPresent
waitForPageToLoad
waitForFrameToLoad
Like locators, patterns are a type of parameter frequently used by Selenium. It allows users to describe
patterns with the help of special characters. Many a time, the text that we would like to verify are
dynamic; in that case, pattern matching is very useful.
Pattern matching is used with all the verification point commands - verifyTextPresent, verifyTitle,
verifyAlert, assertConfirmation, verifyText, and verifyPrompt.
□ Globbing
□ regular expressions, and
□ exact patterns.
Globbing
Most techies who have used file matching patterns in Linux or Windows while searching for a
certain file type like *.doc or *.jpg. would be familiar with term "globbing"
Globbing in Selenium supports only three special characters: *, ?, and [ ].
37
□ [ ] − called a character class, lets you match any single character found within the brackets. [0- 9] matches any
digit.
To specify a glob in a Selenium command, prefix the pattern with the keyword 'glob:'. For example, if you would
like to search for the texts "tax year 2013" or "tax year 2014", then you can use the golb "tax year *" as shown
below.
However the usage of "glob:" is optional while specifying a text pattern because globbing patterns are the default
in Selenium.
ExactPatterns
Patterns with the prefix 'exact:' will match the given text as it is. Let us say, the user wants an exact match with the
value string, i.e., without the glob operator doing its work, one can use the 'exact' pattern as shown below. In this
example the operator '*' will work as a normal character rather than apattern- matching wildcard character.
RegularExpressions
Regular expressions are the most useful among the pattern matching techniques available. Selenium supports the
complete set of regular expression patterns that Javascript supports. Hence the users are no longer limited by *, ?
and [] globbing patterns.
To use RegEx patterns, we need to prefix with either "regexp:" or "regexpi:". The prefix "regexpi" is case-
insensitive. The glob: and the exact: patterns are the subsets of the Regular Expression patterns. Everything that is
done with glob: or exact: can be accomplished with the help of RegExp.
Example
For example, the following will test if an input field with the id 'name' contains the string 'tax year', 'Tax Year', or
'tax Year'.
38
Command Target Value
It is easy to extend Selenium IDE by adding customized actions, assertions, and locator-strategies. It is done
with the help of JavaScript by adding methods to the Selenium object prototype. On startup, Selenium will
automatically look through the methods on these prototypes, using name patterns to recognize which ones are
actions, assertions, and locators.
Let us add a 'while' Loop in Selenium IDE with the help of JavaScript.
Step 2 − Now launch 'Selenium IDE' and navigate to "Options" >> "Options" as shown below.
Step 3 − Click the 'Browse' button under 'Selenium Core Extensions' area and point to the js file that we have
saved in Step 1.
39
Step 4 − Restart Selenium IDE.
Step 5 − Now you will have access to a few more commands such as "Label", "While" etc.
Step 6 − Now we will be able to create a While loop within Selenium IDE and it
will execute as shown below.
Result: Thus, the study of selenium web testing tool is conducted and the results were noted.
40