Web Based Test Scripting

1

C. Bowie

CEN 5070 Semester Project

Web Based Test Scripting

CEN 5070 – Software Verification & Verification

Chantel Bowie

April 26, 2006

Problem Statement

The purpose of this project was to select, demonstrate and promote the use of scripting languages for Windows environments. The chosen candidate, should be platform independent, capable of running in UNIX and Windows and support web based applications. The application will be regenerated into a web based application utilizing Java servlets on the backend to handle form submissions and data. The actual test scripts are used to test the web based application, filling in simple information and showing results.

B. Test Scripting Language for Windows -- select, demonstrate, promote the use of scripting languages for Windows environments. Candidates should be platform independent and capable of running in Unix and Windows, and support web-based applications.

Assigned to: Chantel Bowie

Project Research

The chosen application is based off of the Simple Account class. The simple account class represents a single account holder at a bank. The user transactions that may be performed are: Open Account, Deposit, Withdraw, Check Balance (Show Status), Close Account and Show Monthly Report. A web page was formulated for each of these transactions. The user is allowed to perform these transactions on accounts that are already a part of the application, or from one recently created. The original code for this class was written using the C++ language. The code had to be reconstructed into Java in order to make easy use of Java’s server/servlet capabilities for web applications.

WATIR, pronounced water, is used for the Window’s based web testing. WATIR which stands for Web Application Testing in Ruby uses the Ruby scripting language to automate testing in Window’s Internet Explorer web browser. WATIR utilizes web applications embedded in HTML to perform its scripting. The language employs its very own library to carry out simple processes such as filling in data for text fields or text boxes, checking and unchecking boxes or radio buttons, press buttons, and make selections within drop down menus. The website contains a user guide, sample test documents, scripts and tutorials which are extremely useful documents regarding the use of WATIR and the Ruby language as well as any required downloads for installation of the tools.

Solution Design

The following are screen shots of the system Simple Account web based system.

Upon accessing the system at the user is presented with the following page. Here the person may choose a transaction to perform on an account. The user always returns to this page once completing any transaction. Prior to performing any transaction, the user MUST enter an account number.

On this particular page, the user enters an account number to perform transactions.

If the user needs to create a new account, they are required to enter vital information regarding the account. An account name, account ID and starting balance must be entered for successful account creation. [

To close an account, the user must confirm the action by pushing the “Close Account” button. However, if the user came here accidentally, then they may push the “Cancel” button. [

Selecting Show Account Status brings the user to “Your Account Status” [ page where they must press the “Show Status” button to show their current account balance.

At the end of every month, a monthly report on your account is performed showing all withdrawal and deposit transactions, starting and ending balance for the month, and any non sufficient funding transactions. This is similar to the monthly statements banks send to account holders through mail. [

If the user inadvertently neglected to provide an account ID prior to selecting a transaction to perform, this page shows forcing the user to click on the link to enter an account ID. [

Any invalid information that may have been entered (ID for an account not in the system) results in this error page instructing the user to return back to the main (home) page of the application. [

Allowing the user to withdraw funds from an account. [

Allowing the user to deposit funds into an account. [

Project Artifacts(the things YOU produced)

(This is solution section material) To get started with using the WATIR scripts, you must download and install both the Ruby software and the WATIR software. Instructions for installation of these particular types of software, is provided at If you do not have Microsoft Windows Internet Explorer (the only web browser that may be used with WATIR), then you will need to also install that. Information for Windows Internet Explorer is available at Included in the installation of Ruby and WATIR is an editor which allows you to produce testing scripts for your application.

The following dummy accounts were set up for the Simple Account web application:

Account ID / Account Name / Starting Balance
9910 / CISMO / $750.85
1760 / CIS Department / $75.51
1920 / ACE / $5.51

WATIR test scripts/data for the application:(Give your application a name)

(Somewhere you should describe the language features ... where does Ruby fit in?)

require 'watir'

include Watir

#open to main menu of simple account

ie = Watir::IE.start("

sleep 3

#tries to perform a transaction w/o entering an account

ie.select_list(:name, "wabox").select("Withdraw")

sleep 4

ie.button(:value, "Submit").click

sleep 3

#yuo must enter an account number

ie.link(:url, "

sleep 4

#types 9910 into text field

ie.text_field(:name, "aatext").set("9910")

sleep 3

#presses button to submit account to access

ie.button(:name, "whichb").click

sleep 8

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#close the account 9910

ie.select_list(:name, "wabox").select("Close Account")

sleep 3

ie.button(:value, "Submit").click

sleep 3

#press button to confirm close of the account

ie.button(:value, "Close Account").click

sleep 4

#return to main menu

ie.button(:value, "Home").click

sleep 3

#try to access closed account

ie.select_list(:name, "wabox").select("Access Account")

sleep 4

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "aatext").set("9910")

sleep 3

ie.button(:value,"Access").click

sleep 4

#invalid page, return to main menu

ie.link(:url, "

sleep 3

#create the account 1914, Sigma Man, 15785.28

ie.select_list(:name, "wabox").select("Create Account")

sleep 3

ie.button(:value, "Submit").click

sleep 3

#fill in account ID, account name, starting balance, submit info

ie.text_field(:name, "antext").set("Sigma Men")

sleep 4

ie.text_field(:name, "caidtext").set("1914")

sleep 4

ie.text_field(:name, "sbtext").set("15785.28")

sleep 4

ie.button(:value, "Create Account").click

sleep 12

#returns back to main menu

ie.button(:value, "Home").click

sleep 5

#withdraw from Sigma Men

ie.select_list(:name, "wabox").select("Withdraw")

sleep 3

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "watext").set("1234.14")

sleep 4

ie.button(:value, "Withdraw").click

sleep 8

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#withdraw from Sigma Men

ie.select_list(:name, "wabox").select("Withdraw")

sleep 3

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "watext").set("425.90")

sleep 4

ie.button(:value, "Withdraw").click

sleep 8

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#withdraw from Sigma Men

ie.select_list(:name, "wabox").select("Withdraw")

sleep 3

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "watext").set("332.98")

sleep 4

ie.button(:value, "Withdraw").click

sleep 8

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#deposit to Sigma Men

ie.select_list(:name, "wabox").select("Deposit")

sleep 3

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "datext").set("835.21")

sleep 4

ie.button(:value, "Deposit").click

sleep 8

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#show monthly report

ie.select_list(:name, "wabox").select("Show Monthly Report")

sleep 3

ie.button(:value, "Submit").click

sleep 3

#confirm show monthly report

ie.button(:value, "Show Report").click

sleep 20

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#show status

ie.select_list(:name, "wabox").select("Show Account Status")

sleep 3

ie.button(:value, "Submit").click

sleep 3

#confirm show account status

ie.button(:value, "Show Status").click

sleep 15

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#access dummy account 1920, ACE

ie.select_list(:name, "wabox").select("Access Account")

sleep 4

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "aatext").set("1920")

sleep 3

ie.button(:value,"Access").click

sleep 3

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#withdraw (mistake) from ACE

ie.select_list(:name, "wabox").select("Withdraw")

sleep 3

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "watext").set("35.25")

sleep 4

ie.button(:value, "Withdraw").click

sleep 10

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#deposit to ACE

ie.select_list(:name, "wabox").select("Deposit")

sleep 3

ie.button(:value, "Submit").click

sleep 3

ie.text_field(:name, "datext").set("35.25")

sleep 4

ie.button(:value, "Deposit").click

sleep 10

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

#show monthly report

ie.select_list(:name, "wabox").select("Show Monthly Report")

sleep 3

ie.button(:value, "Submit").click

sleep 3

#confirm show monthly report

ie.button(:value, "Show Report").click

sleep 20

#returns back to main menu

ie.button(:value, "Home").click

sleep 3

References

WATIR.

Ruby.