Sahi Pro - Sahi Reports
abstract
This section explains how reporting works in Sahi and how to customize it.
Reports - Architecture and Flow
When a script is run, steps executed on the browser are automatically logged by Sahi.- All report data is stored in the database by default.
- At the end of a suite, Sahi Pro reads the data from the database and converts them to XML
- The XML is then converted into desired reports using XSL transformations
info By default, Sahi Pro ships with XSLs for html, xml, junit, excel and email formats.
These are stored insahi_pro/config/reports/
folder under folders namedhtml
,xml
etc.
Understanding reports and report types
The wordshtml
and xml
are not special keywords. These can be defined by the user.When Sahi sees the logType as
html
, it will look for a folderuserdata/config/reports/html
or in config/reports/html
.This folder contains various XSL files for transforming data as desired, and a report.properties file.
A brief description of various XSL files:
script_report.xsl | Output for individual scripts |
suite_report.xsl | Output for a single suite |
suites_list.xsl | Creates the default listing of all suites (This may only be needed by the default online reporting) |
testcase_report.xsl | Creates the output for individual scripts but also shows summary of testcases (Refer _testcase() API) |
reconciled_report.xsl | Output for different view of data. For example, to show stepwise time comparisons in a load test |
The names of the output files can be governed by the entries in
report.properties
Eg.script_file.name=<reportId>.html
suite_file.name=index.html
images.copy=true
images.dir=images
Variables available are
<scriptName>
and <reportId>
and will be replaced correctly in the file names.images.copy tells Sahi whether screenshots images should be copied and images.dir specifies the copy destination folder.
Adding logsInfo in testrunner.bat
Openuserdata/bin/testrunner.bat
. Look forSET LOGS_INFO=
and change it toSET LOGS_INFO=html:D:/pathto/htmlLogs,xml:D:/pathto/xmlLogs
Adding logsInfo in drun.bat
Same as for testrunner.batModifying an existing reporting type
Reports are generated using XSLs.
XSL files are by default in subfolders of
config/reports/
.They can be overridden in
userdata/config/reports/
folderSahi will first look for any report xsl in
userdata/config/reports/
.If it is not found, it will default to
config/reports/
For example, xsls for
html
reports are in config/reports/html
folder.To modify existig xsl, copy it over into
userdata/config/reports
with the same subfolder name.
Eg. if you want to modify
config/reports/html/suites_list.xsl
, copy it such that you haveuserdata/config/reports/html/suites_list.xsl
.Now modify this copied file as needed.
Adding a new custom reporting type
To create a new log type copy
config/reports/html
to
userdata/config/reports/mytype
Edit the xsl files as desired. You can test your xsl at runtime by navigating to any existing logs and adding
&type=mytype
at the end of the log url.For example, click on the "Logs" link on the dashboard and drill down to any particular script report.
You may see a URL like this on the browser address bar:
http://localhost:9999/_s_/dyn/pro/DBReports_scriptReport?id=clicksTest__03Nov2011__09_17_36
Add &type=mytype
to the end such that it looks likehttp://localhost:9999/_s_/dyn/pro/DBReports_scriptReport?id=clicksTest__03Nov2011__09_17_36&type=mytype
This will show you your modified output according to the xsl in mytype
folder.When ready with the correct XSL, open testrunner.bat or drun.bat and pass
-logsInfo=mytype
.You will now see the logs created according to your xsls.
warning
The older variables in sahi.properties/userdata.properties are no longer honoured:
reports.filesystem.html.enabled=true
reports.filesystem.xml.enabled=true
reports.db.enabled=true
reports.sql.enabled=true
reports.filesystem.html.enabled=true
reports.filesystem.xml.enabled=true
reports.db.enabled=true
reports.sql.enabled=true
Downloading reports
Multiple suite reports can be downloaded directly from the logs page. One can set the report type from the "Download as" dropdown.
The reports can be downloaded with varying formats including email, html, xml, excel, junit, tm6.
One can also download multiple script reports inside a suite, if there exists any script inside that suite.
Auto Refresh Logs
When one wants to get rid of refreshing the logs page again and again, one can check the auto refresh checkbox.
So while the script or suite is executing, checking the auto-refresh checkbox will refresh the page after every 2 seconds till the excecution completes.
Filtering Network Activity
One can show or hide network activity logs along with other activity logs with following two scenarios:
- Clicking the "Expand all" link will expand the network activity content as well.
- Clicking the "Collapse all" link will collapse the network activity content as well.
- Checking the "Show failed/all" checkbox will show only those steps which has failed network activity.
- Clicking the "Expand all" link will expand the only expand the logs content and not the network activity content.
- Clicking the "Collapse all" link will collapse the network activity content but if "Expand all" is clicked then network activities will show up again.
- Checking the "Show failed/all" checkbox will show only failed steps.