Tuesday 6 April 2010

Selenium

[Test] SIT with Selenium
Wednesday, March 31st, 2010

Automated SIT For DI


Outline

0. Overview
1. Configure SIT Web Application
2. Generating Test Scripts For Each FI
3. Running SIT
4. Detailed Installation Guide
0. Overview
SIT is automated with the SIT web application making calls to the Selenium IDE and Remote Control (RC) tools. Test scripts (suites) can be recorded with the Selenium IDE (a plugin to firefox) and executed with Selenium RC at the command line via Java. To perform full SIT, many test suites need to be executed and the results need to be displayed in an organized way. A user interface (web application) has been written to interface with the Selenium IDE and RC as well as the output results from Selenium. This document explains how to configure the SIT web application, configure SIT scripts for an FI (Financial Institution), run the scripts (through the web app), and how to view the results.
The user takes the following steps to automate SIT for FI’s.

Configure SIT Web User Interface
Generate Test Scripts For Each FI
Run SITon FIs
Top

1. Configure SIT Web Application
The SIT web application comes as a war file, sit.war. After grabbing the sit.war file from cruise control, place the sit.war file under Tomcat’s webapps directory. Click on the sit.war file link in cruise control to save it locally.


Another way to get the sit.war file is to build it by checking out the code from svn and run ant on build.xml against the main target.

Tomcat will explode the sit.war file in the directory structure below.

The SIT web application consists of jsp, java class, and image files. Deploy these files under tomcat’s webapps directory in a folder called “sit”:

WEB-INF directory containing compiled java class files
img directory containing images
batchfiles directory containing Windows batch files calling test scripts
testcases directory containing Selenium test scripts
testresults directory containing Selenium test results
tsgen directory containing scripts to automate creation of Selenium test cases
afidashboard.jsp UI to interact with each FI
selectTests.jsp selects which test to run for an FI
testit.jsp tests, displays results for each FI
build.xml ant build file to build sit.war
Install the following on the client machine:

Selenium IDE and RC
Firefox
ActivePerl for Windows
Tomcat for Windows
Top

2. Generating Test Scripts For Each FI
tsgen.pl and the properties file are part of the SIT web application that got exploded from the sit.war file. Open a command prompt and cd into the tsgen directtory. To generate test scripts for the SIT web application to execute, run the following command:
C:\apache-tomcat-6.0.20\webapps\sit\tsgen perl tsgen.pl properties\propertiesFile
The input to tsgen.pl is a properties file (sample properties files for usecu and vantage west) containing FI specific settings and input parameters to the generated test scripts. After creating a new properties file, please check the file into svn for the project DI_Autoscripts.

2.1 Properties

# template source directory and where to deploy testcases

templatedirtg directory where template test scripts reside
testcasedirtg directory where testcases should be deployed to under webapps directory
# backslashes are escaped (for compatibility with Perl)
# info for batch files

finametg fi name
ibsitetg url to ib site
mbsitetg mobile banking url
testresultsdirtg directory where test results should be deployed to
seleniumservertg file path to selenium-server.jar file
# batch files source and destination

templatebatchdirtg directory containing template batch files
destbatchdirtg directory where batch files should be deployed to
# Test script specific info

# premium bank or not

ispremiumtg true for premium, false for basic bank
## below substitutions in test scripts
### login info

timeoutsg number of milliseconds to wait for a web page to load before timing out
usernamesg username to log in as
passwordsg password for user
mfasuccesssg mfa answers (space separated between each answer)
finamesg finame
invalidUsernamesg value to input as invalid username
invalidUsernameSpecialsg invalid username with special characters
passwordSpecialsg invalid password with special characters
#contact us

phonenumbersg fi phone number
contactfinamesg fi full name
address1sg fi address 1
emailaddrsg fi email address
cityStateZipsg fi city, state, zipcode
# values “typed in” for tests 01-02-*

checkingsg regular expression matchng checking account name
savingssg regular expression matching savings account name
dateSpecialCharssg date with special characters
transactionStartDatesg start date for transaction search
transactionEndDatesg end date for transaction search
# test 01-02-03

transactionnamesg transaction name to look for
#test 01-03-02

loantransactionnamesg loan transaction name
loannamesg regular expression for loan name
#test-1-04-02 transfers, dates also used for payments

futuretransferdatesg future transfer date
futuretransferdatenodashsg future transfer date without the dashes
invalidamountsg invalid amoutn for transfer
pastdatesg past date for transfer
# making payments, 01-05-01

payeesg regular expression for payee name
weekenddatessg weekend date for payment
validpaymonthdatesg valid month and date
# pending payments, 01-05-02

paydatechangesg change payment date to this date
paydatechangemonthdatesg payment date text to look for (month and date)
# location search, test 01-06-02

citysearch2sg city name to search for
statesearch2sg state location belongs in
zipsearch2sg zip code of location
#rates, test 01-06-03

ratessg comma separated rates links
Names for checking, savings, loans, and loan transaction name can be expressed as a regular expresssion. In particular, the checking and savings name should be written in a way to match both the account and tranfers pages. A rule of thumb would be to ignore the numbers at end of the names. Then use the “*” characters to eat up the beginning and end parts of the name.

For example, on the transfers page, the checking account name is “71: PREMIUM CHECKING:7,000″. The same account is displayed in the accounts page as “PREMIUM CHECKING #71″. A regular expression to use for the checing account name can be “*CHECKING*”.

On the accounts page:



On the transfers page:



Top

3. Running SIT
3.1 Runing Selected SIT Testcases on Single FI
To run selected (and possibly the full) SIT test suite, access the SIT Dashboard page. For the local machine, go to http://localhost:8080/sit/afidashboard.jsp. The dashboard shows FI’s available for testing and status of the last run.

Mouseclick the selenium icon next to the FI’s name to go to the test selection screen for that FI.



Now select which test cases to run or to run the full test suite, toggle the checkall checkbox at the top. Press the “Run SIT” button to automate SIT on the selected test cases.



After the test run, the user will be taken to a page displaying the results of full SIT test. Each row in the table list the results of a set of testcases and corresponding result files. Click on a particular results file to view detailed results of that particular testcase.



Click on the Dashboard button to return to the dashboard.

Clicking on a particular test results file will take the user to detailed information about that particular testcase.



3.2 Full SIT on Selected FIs
To run SIT on selected FIs, the user can select the checkbox next to each FI or select all FIs to test by toggling the checkbox on the top. After selecting FIs to test, the user then clicks on the “Run SIT” button.



After running SIT on many FIs, the user will be taken back to the dashboard.

3.3 Viewing Test Results
To view test results for a particular FI, click on the file image in the same row as the FI’s name.



Top

4. Detailed Installation Guide

No comments: