Machine generated alternative text: Software

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

 

Machine generated alternative text: Title In stock Cost Add quantity to cart
CoreJava 5 R&300 O
RubyforRails 12 R&200 O
P thon
R&350 O
Cookbook
[AddlI[cIearjj Logout]

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.

 

Machine generated alternative text: ‘“LII’,
View: ScriDt I Parsed ScriDt I Browser Script I I DB Loas

 

 

Database reports:

 

Machine generated alternative text: V.
« t1OO% “
httpl/sahi.co.in/_sJdyn/pro/DBReports - Windows Internet Explorer
!fl __
File
Edit
View
Favorites
Tools
Help
Favorites
http:/fsahi.co.inf_sJdyn/pro/DBReports
—-
p  — — —-——
_____j4tXJ1Gaog1e
Suite Name Browser Start Time End Time Time Taken Scripts Run Passed Failed Status
Page” Safety” Tools”' ‘“
demosuite
sahi demo.sah
firefox’ Aug 31, 2010 05:44:28 PM! Aug 31, 2010 05:46:30 PM
firefox Aug 31, 2010 04:59:27 PM Aug 31, 2010 04:59:44 PM
121914
16707
!
58
1
56 2 FAILURE
1 0 SUCCESS
demo.suite
demo.suite
firefox Aug 31, 2010 12:20:53 AM Aug 31, 2010 12:22:29 AM
firefox Aug 30, 2010 09:34:33 PM Aug 30, 2010 09:35:29 PM
96384
55438
14
14
14 0 SUCCESS1
14 0 SUCCESS
demosuite
flrefox Aug 30, 2010 09:31:00 PM Aug 30, 2010 09:31:56 PM
55346
14
14 0 SUCCESS
demo.suite
firefox
Aug 30, 2010 08:36:14 PM Aug 30, 2010 08:39:47 PM
213164
58 r
ss
3
FAILURE
demo.suite
firefox
Aug 30, 2010 04:59:18 PM Aug 30, 2010 05:01:41 PM
142801
58
55
3
FAILURE
demo.suite
. demo.suite
demosuite
firefox
Aug 30, 2010 04:21:12 PM Aug 30, 2010 04:21:35 PM
Aug 30, 2010 03:58:12 PM4Aug 30, 2010 04:03:13 PM
Aug 30, 2010 03:46:27 PM Aug 30, 2010 03:48:30 PM
22970
300164
123083
58
58
58
5 0 RUNNING
55 [ ij FAILURE
55 [ 3 FAILURE
firefox
flrefox
demo.suite
demo.suite
demo.suite
flrefox Aug 30, 2010 03:45:07 PM Aug 30, 2010 03r45:44 PM
firefox Aug 30, 2010 03:43:31 PM Aug 30, 2010 03:44:55 PM
flrefox Aug 30, 2010 03:42:25 PM Aug 30, 2010 03:42:51 PM
37742
83492
26275
h
I
11
5
.11L 0 SUCOESS
11 0 SUCCESS:
5 0 SUCCESS
demo.suite
demo.suite
demo.suite
uirefox Aug 30, 2010 02:52:58 PM Aug 30, 2010 02:53:19 PM
flrefox Aug 30, 2010 02:51:48 PM Aug 30, 2010 02:52:26 PM
flrefox Aug 29, 2010 11:05:56 PM Aug 29, 2010 11:06:18 PM
21078
37947
5
5
5 0 SUCCESS
4f 1 FAILUREJ
r
21268
5
5 0
SUCCESi’
-‘ -‘ ‘ - -
I •
! I • I I iiTiWiv,’II t RiL’fl.............__...STtVr
Done
4 Internet p Protected Mode: 0ff

 

 

Suite Report:

 

Machine generated alternative text: Host
gramam
rashmi
Scripts:
firefox
Aug 31, 2010 05:44:28 PM
Aug 31, 2010 05:46:30 PM
121914
Total scripts run 58
Scripts passed 56
Scrips failed 2
IStatus JFAILURE
Suite Name: demo.suite
Browser Type
Start Time
End Time
Time Taken (ms)
Nodes:
Port
9999
9999
Tests executed
43
15
clicksTest.sah
29
0
0
100
%
6383
gramam:9999
events.sah
31
0
0
100
%
7442
gramam:9999
wait long.sah
S
O
0
100
%
13898
gramam:9999
. .
.!.
r.
L IaTifl
Internet I Protected Mode: 0ff

 

 

Script Report:

 

Machine generated alternative text: httpl/sahi.co.i
n/_sJdyn/pro/DBReports_scriptReport?id=clicksTest_3lAug2OlO_17_44_28 - Windows Internet Explorer
O
LJ ¡IIIIFIIIIIII
ryLv ‘J
http:/ sahi.co.in/jJdyn/pro/DBRepoits_scriptReport?id=clicksTest_3lAug2OlO_17_44..’r Lt±I x
http:/fsahi.co.inf_srofDBRepoth_scriptReJ[ V
‘
Google
P
Favorites
V [21 á
Page safety —‘
TQols
! Test Total Steps
Failures
Errors
Success Rate Time
Taken (ms)
6383
Node
gramam:gggg
clicksTest.sah
2g
O
O
loo %
Starting script
_navigateTo(”/demo/clicks . htm”);
_doubleClick(_divÇ’dbl click me”));
Lassnh1flt[D0U8LE_CL1CKJ”, _textaa].valueWTSuT9 31, 2010 05:44:38 PM
_click(_button(”Clear”));
_doubleClick(_button(”dbl click me”));
_assertEqual(”j
)OUBLE_CLICK], _textaÌjjjj].valueIW±wr9 31, 2010 05:44:38 PM
_click(_button(”Clear”));
_click(_button(”click me”));
_click(_button(”Clear”));
_rightClick(_button(”right click me”));
click(_checkbox(0));
J
ssflhi(”[CLICK], _textam].value
_click(_buttonÇClear”));
_rightClick(_div(”right click me”))
); at Aug
31, 2010 05:44:38 PM
LassertEgual(”[R’c’cr_cucKl”, _textarea[jj].vaIu4]; at Aug 31, 2010 05:44:3g PM
assertEqual(”[RIGHT_CUCK]”, _textarea(”t2”).value); at Aug 31, 2010 05:4f:39fij7
_click(_button(”Clear”)); __________ 
[assertTrue(_checkbox(o).checked); at 31, 2010 05:44:3g PM
sahrsaveCondition(”_IastConditionvaIue_O”, _isIE() I I _sahsSafariLike)
• Internet I Protected Mode: Off
4 V k1O0%

 

 

HTML, SQL and XML logs are created in a timestamped folder under sahi_pro/userdata/logs/playback/

 

 

Machine generated alternative text: Computer  D (D:)  Dei  sahi bsahi_pro  sahi  userdata  logs  playback  training_29Aug2010_12_29j0 
Edit View Tools Help
anize w Include in library w Share with w Burn New folder
Name - Date modified Type Size
sql 29-Aug-10 12:29 P... File folder
M xml 29-Aug-10 12:29 P... File folder
e 1_raw_recorded_29Aug2010_12_29_10.htm 29-Aug-10 12:29 P... Chrome HTML Do... 6 KB
e 5_file_with_near_29Aug2010...12...29_10.htm 29-Aug-10 12:29 P... Chrome HTML Do... 16 KB
e index.htm 29-Aug-10 12:29 P... Chrome HTML Do... 4 KB

 

 

 

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!