Integrate with Jenkins

abstract Jenkins and other Continuous Integration systems can trigger Sahi scripts as part of the build process using Sahi's ANT target.

Sahi with Jenkins

Automation is useless without Continuous Integration. Sahi suites should be periodically executed and CI systems can trigger suites when code changes happen. Sahi suites can be triggered via ANT. We configure Jenkins to call Sahi's ANT target and then make Sahi's logs accessible from Jenkins.

Sahi Pro needs real browsers to playback test scenarios. But most Jenkins/build machines run in server mode and do not have a GUI. This forces end users to either try with headless browsers or to execute Sahi scripts remotely.

With Sahi, this is what you can do:

Jenkins machine (J): Run Jenkins on server. No Sahi installed.
Sahi Master machine (SM): Sahi Pro Runner (or Sahi Pro) runs on this machine and behaves as Master
Sahi slave machines (SL1, SL2, SL3): These are slave machines with Sahi Pro Runner (or Sahi Pro) running on them.
Central Database: Sync all the logs from Sahi Master to this machine. For more info, look at Sahi Sync DB.

During the build process:

Jenkins pulls the latest scripts from the Source Control Management (SCM) system. It calls the Sahi ant target. Sahi target copies over the scripts from Jenkins (J) to master (SM). SM then copies scripts to SL1, SL2, SL3, distributes the execution and collects all reports. Sahi ant target then pulls reports from SM to Jenkins. This allows Jenkins to remain a headless server and does not need Sahi installed on it. Also all distribution of scripts and pulling of reports happens through Sahi's ant target itself.

infoWe recommend using Sahi Pro Runner on master, slave and central reports database machines

Prerequisites

Before integration, you will first need an ant target to run the suite file. You can create the ANT target from the editor using playback options. Save the file in any path accessible by Jenkins (say C:\jenkins_sahi) and lets call it build.xml.

info At the end of the configuration steps in this page, your folder structure should look like this:
C:
  |--jenkins_sahi
         |
         |--build.xml
         |--email.properties
         |--lib
             |
             |--ant-sahi.jar
In the build.xml make sure that: Also Install the HTML Publisher plugin if you wish to see HTML logs via Jenkins UI.

Let us assume that Jenkins is available in C:\.jenkins\

Configure Jenkins