9.10. Jenkins integration

Table of Contents

9.10.1. Obtaining the Plugin
9.10.2. Installing the Plugin
9.10.3. Using the Plugin
9.10.4. Execution Results

Jenkins is known as a Continuous Integration (CI) tool. It allows you to kick off processing jobs in response to events, or on a regular schedule. With Jenkins, you can also monitor executions, and examine the results. Jenkins is commonly used to build software, or run regression tests. (For more about Jenkins see https://jenkins.io/.)

Using the plugin described in this section, it is possible to run Squish tests as part of a Jenkins job.

9.10.1. Obtaining the Plugin

The newest Squish Plugin can be downloaded using the following URL: download.froglogic.com/resources/squish-jenkins-plugin_latest.zip. The minimum required Jenkins version for this plugin is Jenkins 2.60.3.

9.10.2. Installing the Plugin

[Note] For Windows nodes executions

Squish tests will fail if the Jenkins node is started as Windows Service and a Jenkins plugin starts squishserver by itself!

If Squish tests must be executed on the Jenkins server make sure Jenkins is not installed as Windows Service. Jenkins can be started alternatively by running “java -jar jenkins.war” from a command line.

To install the plugin, simply unzip the file and move or copy the .hpi file into JENKINS_HOME/plugins where JENKINS_HOME is Jenkins home directory. Once the .hpi file is in the right place it can be enabled simply by restarting Jenkins. After the restart, there should be an entry for the Squish plugin in the Jenkins plugin manager.

[Note] Squish Jenkins Plugin Dependencies

The Squish plugin for Jenkins has some dependencies on other standard Jenkins plugins which need to be installed. The first time you try to load this plugin, it may fail, listing the missing plugins. You can resolve this issue by installing them from the Jenkins Plugin Manager. The plugins are:

  • "Pipeline: API" (workflow-api)

  • "Pipeline: Step API" (workflow-step-api)

  • "Plain Credentials Plugin" (plain-credentials)

  • "Structs Plugin" (structs)

The Jenkins Plugin Manager.

9.10.3. Using the Plugin

9.10.3.1. Squish Global Configuration

After checking that the Squish plugin is correctly loaded, the next step is to add Squish's installations to Jenkins Global Tool Configuration. To do so, select Manage Jenkins -> Global Tool Configuration -> Squish installations... It's possible to specify many Squish installations. For each of them specify an installation path and a unique name.

Jenkins Global Tool Configuration.

The next step is to define a global plugin configuration in Configure System. Usually, there is no need to change anything in that section.

Jenkins Global Configuration.

9.10.3.2. Freestyle Projects

To run Squish tests in the Jenkins build process we must adapt a job configuration to include Squish. Here we will use the address book example that is shipped with Squish.

The only thing left to do is to add a Squish build step to the project configuration. Now one of the specified Squish packages can be selected from the drop-down list. Next, set up the test suite and optionally, the test cases which we want to be carried out. Additionally, host and port may be specified to use an already running squishserver. In the screenshot, we have added one Squish build step which executes the tst_adding test case of the suite_py test suite.

Jenkins Job Configuration.

After Save/Apply changes to the Jenkins project, we can run it.

9.10.3.3. Pipeline Jobs

To run Squish tests in the Jenkins Pipeline, we can use Squish Build Step in our Pipeline script.

To generate proper code we can use Jenkins built-in Pipeline Syntax functionality.

Pipeline Syntax.

As a Sample Step we need to select squish: Runs Squish tests.

Squish Step selection.

After doing that, we can define the configuration the same way we do for Freestyle projects. When the configuration is ready we click on Generate Pipeline Script.

Generate Pipeline Script.

Now we can use generated step in the Pipeline job.

Squish Plugin usage.

Note that the Squish Pipeline Step doesn't set a build result. It returns a test execution status based on test results, global and job configurations. Using that status a user may implement the desired handling.

9.10.4. Execution Results

The summary page lists links to the Squish report page and later on to HTML Reports.

The Jenkins Build Summary - HTML Reports.
The Jenkins Build Summary - HTML Reports.

The Squish report page appears inside Jenkins:

Jenkins Squish Results.