Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Version 2.0
May 7, 2015
Altametrics
Selenium Framework
Page 2
Architecture
Altametrics
3191 Red Hill Avenue
Costa Mesa, CA 92626 USA
Tel: (800) 676-1281
Altametrics
Selenium Framework
Page 3
Architecture
Table of Contents
1
Introduction........................................................................................................ ..4
2
Architecture of Selenium
framework.5
3 TestAutomationConfig.xls
.6-12
3.1 Application
URL
3.2
UserName
.
3.3
Password
.
3.4
MenuStructureFilepath
.
3.5
OutputLogFilepath
.
3.6
BrowserPath
.
3.7
ExceptionTest
..
3.8
TestCaseSheet
3.9
IsStoreManager
.
Altametrics
Selenium Framework
Page 4
Architecture
3.10
IsCorpAdmin
.
3.11
IsSuperUser
3.12
DatabaseUrl
3.13 Database
Username
.
3.14 Database
Password
3.15Store
List
.
3.16 Initial auto unpost unapprove
object
3.17 Store Header
Name
Altametrics
Selenium Framework
Page 5
Architecture
4
MenuStructureFile
13
5
ScriptCreationWithDeferentUser
13-20
5.1 Test Step
No
..
5.2 Take
Screenshot
.
5.3 Click for
Alert
5.5
Action
..
5.6 Sub
Action
5.7
Commands
.
5.7.1 GeneratesCSV +
Click
5.7.2 GenerateFormattedCSV +
Click
5.7.3 Go +
Select
.
Altametrics
Selenium Framework
Page 6
Architecture
5.7.4 Go +
Click
.
5.7.5 Go +
linkclick1
..
5.7.6 Applet +
rightclick+Value..
5.7.7
Applet+click+Value
5.7.13 bindsheet +
end
5.7.14 button + clickbyvisibletext +
Value.
5.7.15 close + click.
Altametrics
Selenium Framework
Page 7
Architecture
5.7.19 validatebreadcrumb.
.
5.7.20 Go + validatesummayobjects.
.
5.7.21 wait + buttons(close,save etc) +
value
5.7.22 waitforinvisibility + buttons(Close, save etc) +
Value
5.7.23 Add + Date + Value...
Altametrics
Selenium Framework
Page 8
Architecture
1. Introduction
Selenium is a portable software testing framework for web applications. Selenium provides a
record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also
provides a test domain-specific language to write tests in a number of popular programming languages,
including Java, C#, Groovy, Perl, PHP, Python and Ruby. The tests can then be run against most
modern web browsers. Selenium deploys on Windows, Linux, and Macintosh platforms. It is open-source
software, released under the Apache 2.0 license, and can be downloaded and used without charge.
Selenium IDE is a complete integrated development environment (IDE) for Selenium tests. It is
implemented as a Firefox Add-On, and allows recording, editing, and debugging tests. It was previously
known as Selenium Recorder. Selenium-IDE was originally created by Shinya Kasatani and donated to the
Selenium project in 2006.
Scripts may be automatically recorded and edited manually providing autocompletion support and the ability
to move commands around quickly. Selenium provides commands for performing actions in a browser (click
a link, select an option). In our framework, Scripts named is Script creation with different user.
Automation framework has different files which names are given bellow:
TestAutomationConfig.xls
Code
TestAutomationTestSteps
AutomationConf.txt
Log
Altametrics
Selenium Framework
Page 9
Architecture
TestAutomat
ionTestSteps
. user
Menu
structure file
CODE
Html output
report
Log
Automation
Conf.txt
Altametrics
Selenium Framework
Page 10
Architecture
3. TestAutomationConfig.xls
TestAutomationConfig file is an excel file which has two sheets. Here we store all basic configurations in a
single sheet which is used in our automation testing. In main sheet i.e name is setting define all basic
configuration file name with their path and value. This excel sheet have all the relevant information of
configuration files which is needed in a testing.
E.g.- This file contains the Application URL on where the server can hit for accessing the application, user
name & password of the application etc.
The snapshots which show the ExecutionTestconf file very well is given bellow-
In this above figure we can see easily the 22 file name which is stored here and colored by green column. The
next columns have the description/value of corresponding this green column.
Altametrics
Selenium Framework
Page 11
Architecture
3.1Application URL- This field have the Application url path which is used to open the application in
the browser.
eg- http://marora:7001/scripts/WebObjects.exe/ERS_AUTO_WED.woa,ETC.
3.2UserName- User name which is used to open the application for automated testing.
Egg- ersadmin, Corp etc.
3.3Password- Password corresponding to the above user name for open the application.
Egg- mcdtest, login1234 etc.
3.4MenuStructureFilepath- This consist the path of the menu structure file which has all information
about the menu items. This path is mapped into the code and we can change path here then code is read the
new path and get the information of menu items according to the new file. By default it is c:\Test\.
3.5OutputLogFilepath- This contains the path on which Logs will be generated after completion a every
step of the Test Case. By default it is c:\Test\.
3.6BrowserPath-Automation tool are used the Mozilla Firefox by default. But if we want to run the
Automation tool into any other Browser then we need to download their DriverServer.exe. E.g. For the
internet explorer need to download their IEDriverServer.exe. And here we give the path where this
DriverServer.exe are stored.
E.g.- C:\Users\test3\Downloads\.
Altametrics
Selenium Framework
Page 12
Architecture
3.13Database Username- It consists the user name of the database where you saved the data and
retrieve the data. Mostly database user name will be your Schema Name and present in the Condict file.
E.g.- ERS_AUTO_WED, feb_2015_training42 etc.
3.14Database Password- This is storing the password corresponding to above database user name.
Mostly It is also the Schema Name and present in Condict file.
E.g. ERS_AUTO_WED, feb_2015_training42 etc.
Note- Snapshot of the Condict file which have all these three above----
3.15Stores List- we want to test more than 1 object or store, then we need to give all those store names
separated by the tilde symbol (~) here, which is called the Stores List.
Note- we need to give the Select Store into the Value column with command linkclickall instead of
linkclick1 into the ScriptCreationCheckListwithDifferentUsers file.
Egg- The snapshot is giving below for it-
Altametrics
Selenium Framework
Page 13
Architecture
3.16Initial auto unpost unapprove object- we give the value TRUE then Automation will open an
object and do unapprove from approved and unpost from post .
Note- This configuration does not apply to the Production Application but we can. Mainly this is used for
our Testing Application.
3.17Store Header Name- Application Screen has a column name which have the store name upon this
column and this is called the Header Name. It may be a Store Name or any friendly name according to the
client requirement.
As above figure is showing that the header name is Store which have the store name list as the arrow is
showing.
3.18Maximum waiting time b/w applet clicks (in Sec.)- In this column we give the seconds
which tells us how much time automation script wait for the next window/Command after clicking the
Applet. If next window is not open in given time, then Automation skip this Step and move to the next
command. So that Testing cant be stopped.
3.19Is applet test is for manager schedule- Till now it is also not in working.
3.20Is Select Role enable while login- value is True if in this column, Automation need to know that
user are doing login from which, either a Store name or any user role.
The snapshot is given bellow-
Altametrics
Selenium Framework
Page 14
Architecture
3.21Select store- Automation select the Store Name from the dropdown which Snagit is given bellow
Note- Home screen will be different if selects the User Role.
Altametrics
Selenium Framework
Page 15
Architecture
3.22Select Role- Automation select the User Role from the dropdown which is given below-
Altametrics
Selenium Framework
Page 16
Architecture
Altametrics
Selenium Framework
Page 17
Architecture
4. MenuStrustureFile
Menu structure file is basically a property file that contains key and value pair. Property file is a part of
programming language to store data according on the basis of key and values. In this file, key symolise the
sub menu name that is an e*RS sub menu and value represends its id that is assigned to it on the UI.
Menu structure file will be created automatically for the very first time ane every time when we login with
different user or different application with the name USERNAME+URL. This name is just for the uniqueness
of the file so tha program can identify it. After that, if menu file already exists, it will fetch the value
according to the given key.
Menu file contents are like :
DashBoard = dijit_MenuItem_0_text
Universal\ Projection = dijit_MenuItem_1_text
Log\ Out = dijit_MenuItem_2_text
Inventory = dijit_MenuItem_3_text
Receiving = dijit_MenuItem_4_text
Note : 1. These id are fetched at the very first time when menu file does not exists.
2 As the code fetch menufile dynamically, id and name may differ according to the user or application.
5. TestAutomationTestSteps
This is the main file for the automated testing. Here we write the all TestCases which is used to test the
application. Write the test cases in the excel sheets and import to sheet into this file.
Note- 1. Always the sheet name should remain same as the Menu Item name and give the friendly name or
comment also with this name using the symbol (|).
Egg- Weekly Labor Scheduler|Wee.View, Weekly Labor Scheduler|verify etc.
This sheet contains the various column name like Test step no, TakeScreenShot, Check for Alert, Check for
Exception, Action, Sub Actions, Command, Values and Skip Step.
Altametrics
Selenium Framework
Page 18
Architecture
5.1Test Step No- Test Cases are always written into test steps means every test case has many numbers of
test steps. This column represents how many numbers of test step are here.
5.2TakeScreenShot - We want to take the screen shot after this step, then we have to assign the value 1
into this column. Except, of value 1 it will not take the screenshot.
Altametrics
Selenium Framework
Page 19
Architecture
5.4Check for Exception- In this column except of value 0, check the exception for all the values either
string or blank, which are coming after performing this step to the application.
5.5Action- In this column give the description of the sub Action with command means it describe the
message or comment which are doing through the Sub Action with Command.
5.6Sub Action- This column contains the name on which the commands are executed like Applet, Go etc.
5.7Command- Command is the main thing in this whole process of testing. Using command performs all
Test Steps which we needed in our application for testing.
Altametrics
Selenium Framework
Page 20
Architecture
Altametrics
Selenium Framework
Page 21
Architecture
Sub Action:
Generate CSV
Command:
Click
Value:
Not required
Description:
Altametrics
Sub Action:
Selenium Framework
Page 22
Architecture
GenerateFormattedCSV
Command:
Click
Value:
Not required
Description:
Sub Action:
Go
Command:
Select
Value:
Case1: no value
Case2: mismatch value
Case3: match value
Case4: setdaterange (date range)
Case5:validateoptions(Dropdown Options)
Altametrics
Selenium Framework
Page 23
Architecture
Case6:setstore(getuniversalstore)
Description:
For case1: Middle value from the dropdown list will be selected.
For case2: Middle value from the dropdown list will be selected.
For case3: Matched value will be selected.
For case4: To set date range so that further commands like validatesummaryobjects
can use that date. Note: You can only pass the existed value of date range dropdown.
Otherwise it will throw an exception.
For case5: This command is used to validate the select date range dropdown
whether the list contains date range in the following sequence: Select All, 1 Week, 2
Week, 4 Week, 1 Month, 3 Month, 6 Month, 1 Year, 2 Year, 5 Years"
For case6: Pick the store which is stored in TestAutomationConfig named file and
after tha we can use it anywhere by using getuniversalstore keyword in the value
column.
Altametrics
Selenium Framework
Page 24
Architecture
Sub Action:
Go
Command:
Click
Value:
Not required
Description:
Altametrics
Selenium Framework
Page 25
Architecture
Sub Action:
Go
Command:
linkclick1
Value:
Not required
Description:
This command is used to click on the summary obect links using its index. E.g.
linkclick1 will click on the first object.
Sub Action:
Applet
Command:
Right click
Value:
Description:
Case 1. Search and rightclick on the image whose path is given in value column.
Case 2. Search and rightclick on the text given in value column.
Altametrics
Selenium Framework
Page 26
Architecture
The process of performing this whole command, the snapshot is given below-
Sub Action:
Applet
Command:
click
Value:
Altametrics
Description:
Selenium Framework
Page 27
Architecture
Case 1. Search and leftclick on the image whose path is given in value column.
Case 2. Search and leftclick on the text given in value column.
Sub Action:
Applet
Command:
Hover
Value:
Description:
Case 1. Search and hover over the image whose path is given in value column.
Case 2. Search and hover over on the text given in value column.
Altametrics
Selenium Framework
Page 28
Architecture
The snapshot shows all of thing which is given bellow-
Sub Action:
Applet
Command:
Add Shift
Value:
Description:
Select the values from drop down of Add Shift dialog box of applet before
performing the next step like job type, employee name etc.
Altametrics
Selenium Framework
Page 29
Architecture
Bindsheet
Command:
Start
Value:
Sheets\\LOA.xls.
Description:
Binding one sheet to another sheet for mapping the column values from
the given path. Eg: C:\\HrTestCasesSel\\Test Data
Sheets\\LOA.xls.
Command:
Click
Value:
Not required.
Description:
Click on the tab whose index is given in the value subaction column
along with hrtab keyword. E.g. the above will click on the 6th tab means
wage/job code.
Altametrics
Selenium Framework
Page 30
Architecture
Command:
Click
Value:
Not required.
Description:
This will click on the detail tab whose index is given along with Tab
keyword. E.g : it will click on tab 2 i.e Hr Maintainence.
Altametrics
Selenium Framework
Page 31
Architecture
Bindsheet
Command:
End
Value:
Not Required
Description:
This command works with Binsheet start. If execution completes i.e all
the rows of test data sheet have been executed successfully, it will move
to next line item other wise it will take the control again to upper
bindstart sheet again and again until all the sheets of Test Data sheet
completes its execution.
Button
Command:
Clickbyvisibletext
Value:
Button name
Description:
Altametrics
Selenium Framework
Page 32
Architecture
Close
Command:
Click
Value:
Not Required
Description:
Altametrics
Selenium Framework
Page 33
Architecture
Post
Command:
Click
Value:
Not Required
Description:
Save
Command:
Click
Value:
Not Required
Description:
Altametrics
Selenium Framework
Page 34
Architecture
Sub Action:
Unpost
Command:
Click
Value:
Not Required
Description:
Altametrics
Selenium Framework
Page 35
Architecture
5.7.19SubAction: validatebreadcrumb, Command:Blank, Value:Not RequriedThis sub-action validate the path of the current screen in the application like Food > Menu Mix > 023486, Orlando, FL
> 06/16/2015
Sub Action:
Validatebreadcrumb
Command:
Blank
Value:
Blank
Description:
5.7.20SubAction:Go, Command: validatesummayobjects, Value:Not Required:This command is used to validate the date objects on the summary screen according to selected date range
from the dropdown.
Sub Action:
Go
Command:
Validatesummayobjects
Value:
Not Required
Description
Description:
Altametrics
Selenium Framework
Page 36
Architecture
5.7.21SubAction:wait
Command:close/Go/save/post/saveandclose/Delete/Approve/Unpost/Unaprove
Value:Required: Next step will not be executed until, the Go / Close button will not find within time in the value column and
time will be given in seconds in the value column.
Sub Action:
Wait
Command:
Value:
Time will be given in seconds in the value column. E.G. 120 means 2
minutes.
Description:
Altametrics
Selenium Framework
Page 37
Architecture
5.7.22SubAction: waitforinvisibility,
Command:close/Go/save/saveandclose/Post/Approve/Delete/post/Unapprove,
Value:Required: - Go or Close button will not be invisible, next step Will wait for execution within time
in the value column. Time will be given in seconds in the value column.
Sub Action:
Waitforinvisibility
Command:
Value:
Time will be given in seconds in the value column. E.G. 120 means 2
minutes.
Description:
5.7.23SubAction:Add ,Command: date ,Value: Required: - This command will be used to give
Sub Action:
Add
Command:
Date
Value:
Case 1. currentdate
Case 2. currentdate+n
Case 3. currentdate-n
Case 4: MM/DD/YYYY
Description:
Note: if there is any syntax mistake while giving value in value column,
it will pass that value and it may create problems in execution process.
dates
when a
new
object
will be
added.
Altametrics
Selenium Framework
Page 38
Architecture
Altametrics
Sub Action:
Selenium Framework
Page 39
Architecture
Searchforvisibility
Command:
Span/td/text/textarea/button/xpath(friendly name)
Value:
Case1- No value
Note-
Case2-Value mismatch
Case3-value matched
Case4-td/span/text
Case5-textarea
Case6-xpath(friendly name)
Description:
For case1: This will check for the visibility of empty tag.
For case2: It will fail the step.
For case3: This will pass the step.
For case4-This is used to search the content on screen which is given in
the value column. The content will be according to the tag given in
command column and that may be span/text/td/textarea/button.
For case5- This will search for the value given in value column under the
tag textarea.
For case6- In this, we have to pass xpath friendly name within the
braces.(friendly name is defined in xpath.properties file). After that using
this xpath, it will search for the value that is given in the value column. It
works with xpath as given.
Automation team will let you know whether to use span, td or text in command column
Altametrics
Selenium Framework
Page 40
Architecture
Sub Action:
Validatecolumn(Column Name)
Command:
Value:
Description:
5.7.26SubAction: readrow, Command: r(index), Value: Not Required:This command is used to read the row value of record on detailed screen.
Sub Action:
Readrow
Command:
Value:
Not Required
Description:
This command is used to read the row according to the index given in
command column. This will store the whole row in the code internally
and that we can further use.
2015 Altametrics. All rights reserved.
Altametrics
Selenium Framework
Page 41
Architecture
Sub Action:
Validatecolumn(column header )
Command:
Value:
latestvalueof(column/header name)
Description:
Altametrics
Selenium Framework
Page 42
Architecture
Altametrics
Selenium Framework
Page 43
Architecture
Sub Action:
switchtomenu
Command:
Not required
Value:
Description:
This command is used to switch to other the menu whose name is given
in value column.
Sub Action:
chart
Command:
click
Value:
Description:
5.7.30SubAction:checkalert, Command: not required, Value: actual message: 2015 Altametrics. All rights reserved.
Altametrics
Sub Action:
Selenium Framework
Page 44
Architecture
checkalert
Command:
Value:
Actual message
Description:
This command is validate the validation message that we get get after
clicking on any button like close, save etc.
Sub Action:
validatesummaryobjects
Command:
Not required
Value:
Not required
Description:
Sub Action:
validateshowall
Command:
Not required
Value:
Not required
Description:
Altametrics
Selenium Framework
Page 45
Architecture
Sub Action:
Thread
Command:
sleep
Value:
Description:
This command is used to stop the script for the time given in value
column.
5.7.34SubAction:testfood, Command:
actioninnertextclick/actioninnertextvisibility, Value: Object name under action
tab of detail screen:-
Sub Action:
testfood
Command:
Case 1. Actioninnertextclick
Case 2. Actioninnertextvisibility
Value:
Description:
Sub Action:
testfood
Command:
validateCatalogFolio
Value:
Not required
Description:
Altametrics
Selenium Framework
Page 46
Architecture
Sub Action:
Command:
Not required
Value:
Not required
Description:
Sub Action:
Columnheader
Command:
Click
Value:
Column name
Description:
Sub Action:
readrowandvalidate
Command:
all
Value:
Not required
Description:
To read all the rows with all the data as showing in summay screen
table/detail screen table.
Altametrics
Selenium Framework
Page 47
Architecture
Sub Action:
Tab
Command:
currentvisibletab
Value:
Tab name
Description:
To validate the current tab with tab name given in value column.
Sub Action:
Validatecolumn(column name)
Command:
r(row index)
Value:
Description:
Case 1. To validate the value that comes after appliying formula like
multiplication of two column values of the row whose row index is given
in command column.
Case 2. To validate the latest value of the column name that has already
been set in previous commands for the row whose row index is given in
command column.
Altametrics
Sub Action:
Selenium Framework
Page 48
Architecture
Intablelinkr(row index)c(column click)
Command:
click
Value:
Not required
Description:
This command is used to click on the link that comes under the summary
screen table or detail screen table. This works according to the row index
and column index given with it.
E.g : To click on the link that is coming in table on 4th row and 3rd
column. We have to use intablelinkr4c3 in sub action.
Sub Action:
Command:
click
Value:
Not required
Description:
This command is used to check the checkbox that comes under the
summary screen table or detail screen table. This works according to the
row index and column index given with it.
E.g : To check the checkbox that is coming in table on 4th row and 3rd
column. We have to use intableCheCkboxr4c3 in sub action.
Altametrics
Sub Action:
Selenium Framework
Page 49
Architecture
Intabletextr(row index)c(column click)
Command:
text
Value:
Case 1. text
Case 2. Latestvalueof(stored name)
Description:
This command is used to sned data in the textbox that comes under the
summary screen table or detail screen table. This works according to the
row index and column index given with it.
E.g : To send text in a textbox that is coming in table on 4th row and 3rd
column. We have to use intabletextr4c3 in sub action.
Case 1. To send the text from value column to the textbox.
Case 2. To send the text from already stored value that was set initially.