Copyright (C) SAS Institute
General Public License: http://www.opensource.org/licenses/gpl-license.php
Be sure to check the latest Whats New In SAFS doc for the latest updates on SAFS and Selenium Support!
This tutorial intends to help you run SAFS tests with the SAFS Selenium WebDriver Engine.
(Use of the deprecated SAFS Engine for Selenium 1.x--before WebDriver--is highly discouraged.)
The SAFS Selenium WebDriver Engine is part of:
This document supposes the installation directory:
See the online version of this doc with images.
Prerequisites:
Make sure you have the latest SAFS on your machine (see above).
Next, verify that the following 3rd-party jars (among others) are in folder C:\SAFS\lib:
Finally, you could make sure that these jars are added to environment variable 'CLASSPATH':
(Make sure any earlier versions of the selenium-server-standalone JAR(s) are removed from the CLASSPATH:)
However, note that most tests are launched from BAT files that will override any CLASSPATH environment variable setting.
Start from "SAFS Selenium sample"
1. The structure of "SAFS Selenium sample" project
Goto folder C:\SAFS\samples\Selenium2.0
This folder is the ProjectRoot defined in the section SAFS_PROJECT of configuration file. The folder will contain files/folders as below.
SafsDevTest.ini | --- Test configuration file |
test.ini | --- Default configuration file |
testSele.bat | --- Batch to Run test script |
runSE2ProcessContainer.bat | --- Batch to Run the WebDriver Processor Container |
Datapool\google.map | --- Application map file |
Datapool\SafsDevTest.CDD | --- Test Cycle file |
Datapool\KeywordHtmlTest.STD | --- Test Suite file |
Datapool\SeleniumEditBoxTest.SDD | --- Test Step file |
Datapool\Bench | --- Folder containing bench files |
Datapool\Dif | --- Folder containing diff files |
Datapool\Logs | --- Folder containing SAFS logs |
Datapool\Runtime | --- Folder |
Datapool\Test | --- Folder containing files generated during test. |
doc\ | --- Folder of documentation |
extra\ | --- Folder of dependencies |
These are configuration files that contain information which tells SAFS where and how to load user's test scripts, what engine to use, and the configuration about the engine etc..
test.ini is the default that will be sought if no INI file is specified in command-line parameters.
Normally, only advanced users would ever go in and change any of these settings.
However, settings flagged as CRITICAL will likely have to changed for your environment.
Note that '#' or ';' can be used to make a line an ignored COMMENT.
------------------------------------------------------------------
[SAFS_DRIVER] DriverRoot="C:\SAFS" [SAFS_PROJECT] ProjectRoot="C:\safs\samples\Selenium2.0" [SAFS_TEST] TestName="SafsDevTest" TestLevel="Cycle" CycleSeparator="," CycleLogName="SafsDevTest.cycle" CycleLogMode="TEXTLOG|XMLLOG|CONSOLELOG" [SAFS_SELENIUM] AUTOLAUNCH=TRUE GATEWAYHOST=your.gateway.com GATEWAYPORT=80 HOOK=org.safs.selenium.webdriver.SeleniumHook BROWSER="firefox" # SETUP to connect to Optional Remote Selenium Standalone Server # SELENIUMHOST=host.domain.com # SELENIUMPORT=4444 [SAFS_ENGINES] First=org.safs.tools.engines.SAFSSELENIUM------------------------------------------------------------------
If you need a Gateway to Access the Internet, please modify the folloing 2 settings:
If you do not use a gateway, please add semi-colon '#' before these 2 settings to make them comments.
If you intend to connect to a Remote Standalone Selenium Server:
If you do not use this, please add semi-colon '#' before these 2 settings to make them comments.
After setting the %CLASSPATH%, there is only one command line as shown below. SAFSDRIVER Command Line takes SafsDevTest.ini as its project configuration file, launches the Selenium Engine and runs each step defined .CDD, .STD, .SDD files.
After setting the %CLASSPATH%, there is only one command line as shown below. It takes (initially missing) se2processcontainer.ini as its project configuration file and launches the WebDriver Process Container:
Because the se2processcontainer.ini is initially missing, the Process Container should resort to the test.ini file for initial configuration.
They are test tables containing test records, refer to Automation Workflow for details.
This is an application map file. It contains the Recognition Strings of the GUI components of Google Search page.
How do I get/specify the Recognition Strings for Selenium WebDriver?
If equal sign (=) exists in the id, name, XPATH, CSS etc. expression, you need to escape it by backslash (\)
Take the Google page as example:
2. Use Process Container
3. Run SAFS Test with Selenium
When running testSele.bat:
The log file SafsDevTest.cycle.txt should be output into the
C:\SAFS\samples\Selenium2.0\Datapool\Logs directory.
Carl Nagle, SAS Project Lead, SAFSDEV Subscribe to appropriate Support Forums to review support archives and ask questons.