Reports

abstract When a suite or script is executed, detailed reports of suite, script, steps and errors are automatically created by Sahi and stored in a database. Reports can be viewed as a web page, or downloaded as offline files in various formats. Reports can also be synced to a central database or between Sahi installations. The appearance of reports can be modified via XSL style sheets. Various other parameters of reports can be also be configured.

Sahi Statuses

StatusDescriptionColor
SUCCESSScripts which has passed all the steps or test cases.GREEN
FAILUREScripts which has at least one step or test case failed. Assertion failure, Syntax error also come under this.RED
ABORTEDWhen browser hangs or goes unresponsive for certain period of time. Default is 90 second.BROWN
SKIPPEDScripts which are skipped from execution due to depended scripts failure. Refer Data driver suite section.GREY
NOT_SUPPORTEDScripts which are not executed due to unavailability of required resources.DARK GREY
USER_ABORTEDOccurs when script execution has stopped manually by user through Stop All button in Editor or Stop button in Controller.BROWN
RUNNINGScripts which are still in execution state.YELLOW

Report Screens and Navigation

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

Check the auto-refresh checkbox to automatically refresh the page to show current status of suite. The logs page will refresh every 2 seconds till the excecution completes.

Javascript Code Coverage Reports

Clicking on JS Code Coverage Report link on Suite and Script Reports pages, shows code coverage reports. Refer: JS Code Coverage Report section for details.

Suite Analysis

Clicking on Suite Analysis link on Suite and Script Reports pages, shows code script failure reports. Refer: Suite Analysis section for details.

Reports - Architecture and Flow

When a script is executed, steps 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

Sahi Pro reports can be generated and downloaded in various report types. By default, Sahi Pro ships with html, xml, junit, excel and email 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 report.properties 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. (Testcases are defined in Scenario files.)
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 are defined 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.

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 userdata/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 like
http://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.

Report Customizations

Sort suite report

By default the suite report will be sorted by script STARTTIME, but if user wants to sort the suite report by SCRIPTNAME, follow the below steps.
  1. Take a backup of config/reports/html/suite_report.xsl.
  2. Open config/reports/html/suite_report.xsl
  3. Search for
    <!-- <xsl:sort select="SCRIPTNAME" /> -->
    and uncomment it.

Add custom fields in Suite reports

From Sahi Pro v6.3.0, user can add custom fields in Suite report as well. Suppose you need two custom fields: customField and anotherCustomField
  1. Take a backup of config/reports/html/suite_report.xsl.
  2. Open config/reports/html/suite_report.xsl
    1. Custom field headers search for
      <!-- Custom Field header-->
      <!--<td id="RowNo">Custom Field</td>-->
      and change it to
      <!-- Custom Field headers-->
      <td id="CustField1">Custom Field</td>
      <td id="CustField2">Another Custom Field</td>
    2. Custom field values search for
      <!--Retrieve custom field value-->
      <!-- <td>
      <xsl:if test="$suiteInfo != 'null'">
      <pre><xsl:value-of select="util:fetchInfo($suiteInfo, 'customField')" /></pre>
      </xsl:if>
      </td> -->
      infoNOTE: There will be two occurences for Retrieve custom field value. Make sure you replace at both occurences.
      and change it to
      <!--Retrieve custom field values-->
      <td>
      <xsl:if test="$suiteInfo != 'null'">
      <xsl:value-of select="util:fetchInfo($suiteInfo, 'customField')" />
      </xsl:if>
      </td>
      <td>
      <xsl:if test="$suiteInfo != 'null'">
      <xsl:value-of select="util:fetchInfo($suiteInfo, 'anotherCustomField')" />
      </xsl:if>
      </td>
      info NOTE: Add as many entries as there are custom fields.

Set pass threshold percentage for Suite or Data Driven Suite

From Sahi Pro v7.5.0, user can set pass threshold percentage for Suite or Data Driven Suite. Suppose the user need to see log result as success for more than 75% in the scripts of a suite or dd.csv, then the user can set pass threshold percentage to 75%.

  1. Click the Configure link on Sahi dashbord and go to userdata properties.
  2. Then select sahi properties and search for sahi.pass_threshold_percentage.
  3. The default value is set to 100, update the value as required.
Now in log result user will see reports as success, if scrips pass percentage is more than required value. The user can see the details of success and failure of all the scripts in suite report.

Offline logs for Controller Playback

By default offline logs are not created for playback via Controller. If needed, offline logs for playback via Controller can be specified in userdata.properties by setting controller.offline_logs.type property
# Sets the type of offline logs created when script is run from Controller. Set to blank to disable offline logs
controller.offline_logs.type=html


Deleting DB reports

If you want to delete the unwanted logs and reduce the size of database, follow the below procedure:

  1. Close Sahi(if running).
  2. Open a command prompt and cd to sahi_installation_folder/userdata/bin
  3. Run delete_reports.bat/delete_reports.sh to see the syntax
    D:\SahiPro\userdata\bin>delete_reports.bat -- Usage: delete_reports.bat "-duration=<duration_in_number_of_days>" Example: To delete reports older than 30 days: delete_report.bat "-duration=30" The duration_in_number_of_days is greater than or equal to 0. -- D:\SahiPro\userdata\bin>