The Email-ext plugin can be used in Jenkins to send email notifications. This article describes how a Squish test summary can be added to such an email.
Adding a Squish test summary to the email being sent is done using a Groovy script which:
needs to be placed on the Jenkins server
needs to be configured for the Email-ext plugin
An example Groovy script can be downloaded squish-jenkins-summary.zip .
Place the Groovy script on the Jenkins server¶
The Email-ext plugin defines that the Groovy script needs to be placed on the Jenkins server at
JENKINS_HOME\email-templates so it might be that the folder
email-templates needs to be created.
Configure the Groovy script for the Email-ext plugin¶
The Groovy script placed on the Jenkins server needs to be configured in the
Pre-send Script field of the Jenkins jobs
Editable Email Notification Post-build Action.
The Pre-send Script field shows up after the
Advanced Settings... section was opened which can be found in the Editable Email Notification Post-build Action.
All which needs to placed in the Pre-send Script field is:
as shown here:
Configure triggers for the Email-ext plugin¶
If an email is send by the Email-ext plugin depends on the configured triggers and on the build result.
To always send emails independent of the build result an
Always trigger can be added:
Example Squish test summary¶
A Squish test summary added to the email can look like this:
which lists the executed test suites and whether their test cases passed or failed.
Placing the Squish test summary table¶
By default the Groovy script appends the Squish test summary to the
Default Content configured for the Editable Email Notification.
If the summary table should be placed differently the string
SQUISH_SUMMARY can be used which will be replaced by the summary:
Customizing the Squish test summary¶
Adapting the example Groovy script to customize the Squish test summary is possible. The Groovy script evaluates Squish’s generated XML report using GPath to retrieve the required information for the summary.
Squish’s XML 2.1 format is described in the Squish manual at
The xml2.1 XML Report Format
. XML schema files also for different XML versions can be found in every Squish package at
To help checking a customized summary the Groovy script can be executed outside of Jenkins by passing a folder which contains Squish test results as argument.
The example Groovy script file available
contains two Squish test result files within the
Running the script like:
summary.html file in the example_test_results folder.