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.
  1. All report data is stored in the database by default.
  2. At the end of a suite, Sahi Pro reads the data from the database and converts them to XML
  3. 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 in sahi_pro/config/reports/ folder under folders named html,xml etc.

Understanding reports and report types

The words html 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 folder
userdata/config/reports/html or in config/reports/html.

This folder contains various XSL files for transforming data as desired, and a file.

A brief description of various XSL files:

script_report.xslOutput for individual scripts
suite_report.xslOutput for a single suite
suites_list.xslCreates the default listing of all suites (This may only be needed by the default online reporting)
testcase_report.xslCreates the output for individual scripts but also shows summary of testcases (Refer _testcase() API)
reconciled_report.xslOutput 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 Eg.<reportId>.html

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

Open userdata/bin/testrunner.bat. Look for
and change it to
SET LOGS_INFO=html:D:/pathto/htmlLogs,xml:D:/pathto/xmlLogs

Adding logsInfo in drun.bat

Same as for testrunner.bat

Modifying 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/ folder

Sahi 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 have
Now modify this copied file as needed.

Adding a new custom reporting type

To create a new log type copy

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:
Add &type=mytype to the end such that it looks like
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 are no longer honoured:

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:
  • If network activity checkbox is checked, now
    1. Clicking the "Expand all" link will expand the network activity content as well.
    2. Clicking the "Collapse all" link will collapse the network activity content as well.
    3. Checking the "Show failed/all" checkbox will show only those steps which has failed network activity.
  • If network activity checkbox is not checked, now
    1. Clicking the "Expand all" link will expand the only expand the logs content and not the network activity content.
    2. Clicking the "Collapse all" link will collapse the network activity content but if "Expand all" is clicked then network activities will show up again.
    3. Checking the "Show failed/all" checkbox will show only failed steps.