Sahi Pro Version 1.0
Sahi Pro builds on Sahi's open source code to add significant time saving features. These include:
1) Distribute tests across machines
2) Automatically accept SSL certificates
3) Easily edit and refactor Sahi scripts using the Sahi Script Editor
4) Easily record _near and _in based accessors from the Controller
5) Log results to database
6) Build reports from the database
|
|
|||
|
|
| ||
|
|
Sahi Pro Controller - New Features |
||
|
|
|
|
|||||
|
|
|||||
|
|
The Anchor helps identify one element relative to another.
Usage: CTRL - Mouse over Element1 on browser Click the Anchor button CTRL - Mouse over Element2 on browser. Element2 will be resolved relative to Element1 |
||||
|
|
|||||
|
|
Recorded steps tab shows steps as they are recorded |
||||
|
|
|||||
|
|
Sahi Script Editor brings up a simple Editor. It helps edit scripts right from the Controller. | ||||
|
|
|||||
Using the Anchor button
Suppose we need to identify the third textbox in the UI below
Using the Sahi Script Editor
|
|
|||
|
|
|||
|
|
| ||
|
|
Auto acceptance of SSL Certificates
Sahi can distribute and run tests on multiple machines (nodes)
Configuration:
Browser paths need to be specified on each node by editing sahi_pro/userdata/config/browser_types.xml on that node.
The XML is as shown below:
<browserTypes>
<browserType>
<name>firefox</name>
<path>C:\\Program Files\\Mozilla Firefox\\firefox.exe</path>
<options>-profile $userDir/browser/ff/profiles/sahi$threadNo -no-remote</options>
<processName>firefox.exe</processName>
<capacity>5</capacity>
</browserType>
<browserType>
<name>ie</name>
<path>C:\\Program Files\\Internet Explorer\\iexplore.exe</path>
<options>-noframemerging -extoff</options>
<processName>iexplore.exe</processName>
<capacity>5</capacity>
</browserType>
</browserTypes>
Name is the identifier for any browser type. It can be anything like ie6, ie7, xp_ie8 etc.
Path is the path to the browser exe
Options and processName are dependent on the browser and can be looked up on
http://sahi.co.in/w/Running+multiple+tests+in+batch+mode
Capacity specifies the number of instances that run on that node without hanging the system.
Once Sahi is started on all nodes, a suite can be run using this ant target:
<taskdef name="sahid" classname="in.co.sahi.ant.DAntRunner" classpath="lib/ant-sahi.jar"/>
<target name="drun">
<tstamp>
<format property="ts" pattern="yyyy_MM_dd_HH_mm_ss" locale="en, IN"/>
</tstamp>
<property name="tempdest" value="scritps/${ts}"/>
<sahid suite="${tempdest}/demo/demo.suite"
baseurl="http://${urlbase}/demo/"
sahihost="localhost"
sahiport="9999"
failureproperty="sahi.failed"
haltonfailure="false"
browserType="firefox">
<sync originFolder="userdata/scripts" destFolder="${tempdest}" ignorePattern=".*(svn|copied).*"/>
<node host="localhost" port="9999"/>
<node host="machine1" port="9999"/>
<node host="machine2" port="9999"/>
</sahid>
<antcall target="failsahi"/>
</target>
Sahid is the task which can distribute tests across multiple machines.
<sync> copies the originFolder to destFolder. destFolder will be created in sahi_pro/userdata directory on every node. In this target we are dynamically creating a directory every time based on timestamp.
The nodes have to be specified using <node> tags.
browserType specifies the type of browser to pick. This maps to the "name" attribute in browser_types.xml
Reports
Reports are logged into the database or to the filesystem based on settings in sahi.properties or userdata.properties
reports.filesystem.html.enabled=false
reports.filesystem.xml.enabled=false
reports.db.enabled=true
reports.sql.enabled=false
# Database logging.
# Tables are created using sahi/userdata/config/db/create_report_tables.sql
db.driver_name=org.h2.Driver
db.jdbc_url=jdbc:h2:$userDir/database/db0;DB_CLOSE_DELAY=-1
db.user_name=sa
db.password=
db.script_gen_xsl=$userDir/config/db/script_sql_gen.xsl
Database Reports for distributed runs can be accessed at http://localhost:9999/_s_/dyn/pro/DBReports
This URL is available as a link at the bottom of Playback tab.
Database reports:
Suite Report:
Script Report:
HTML, SQL and XML logs are created in a timestamped folder under sahi_pro/userdata/logs/playback/
HTML logging converts result XML to HTML using XSL files in sahi_pro/userdata/config/reports.
Database logging is done by first converting XML to SQL using XSL files in sahi_pro/userdata/config/db
and then firing those queries against the database configured in sahi.properties or userdata.properties.
Database tables are created if required using sahi_pro/userdata/config/db/create_report_tables.sql
Sahi Pro is bundled with H2, a filesystem based small database. The database files are in sahi_pro/userdata/database.
The files db0.h2.db, db0.trace.db and db0.lock.db can be deleted to recreate logs from scratch.
Happy testing with Sahi Pro!