CruiseControl Integration

CruiseControl is a framework that supports a continuous build and integration process. It includes, but is not limited to, plugins for email notification, Ant and various source control tools. A web interface is provided to view the details of the current and previous builds.

It is possible to run Squish tests from a CruiseControl continuous build using the plugin described here.

Obtaining the CruiseControl Plugin

The CruiseControl plugin is available from: https://resources.qt.io/hubfs/Squish/squish-cc-plugin_latest.zip

Installing the CruiseControl Plugin

To install the plugin, simply extract the zip archive and copy the jar files to CC_HOME\lib.

Using the CruiseControl Plugin

Here is the example used in the CruiseControl distribution:

<cruisecontrol>
  <project name="connectfour">

    <property environment="env" />

    <listeners>
      <currentbuildstatuslistener file="logs/${project.name}/status.txt" />
    </listeners>

    <bootstrappers>
      <antbootstrapper anthome="${env.ANT_HOME}" buildfile="projects/${project.name}/build.xml" target="clean" />
    </bootstrappers>

    <modificationset quietperiod="30">
      <!-- touch any file in connectfour project to trigger a build -->
      <filesystem folder="projects/${project.name}" />
    </modificationset>

    <schedule interval="300">
      <ant anthome="${env.ANT_HOME}" buildfile="projects/${project.name}/build.xml" />
    </schedule>

    <log>
      <merge dir="projects/${project.name}/target/test-results" />
    </log>

    <publishers>
      <onsuccess>
        <artifactspublisher dest="artifacts/${project.name}" file="projects/${project.name}/target/${project.name}.jar" />
      </onsuccess>
    </publishers>

  </project>
</cruisecontrol>

The Squish CruiseControl plugin must be declared before using it. The best way to do this is to declare it as the project's first child. If we apply this to the example shown above, the first few lines will now look like this:

<cruisecontrol>
  <project name="connectfour">

    <plugin name="squishtest" classname="com.froglogic.squish.cc.builders.SquishTestBuilder" />
  ...

To run a Squish test, the following change must be made to the schedule section:

...
<schedule interval="300">
  <composite>
    <ant anthome="${env.ANT_HOME}" buildfile="projects/${project.name}/build.xml" />
    <squishtest
      suite="C:\Squish\examples\qt\addressbook\suite_py"
      path="C:\Squish" />
  </composite>
</schedule>
...

The composite is needed since we have multiple tasks in this case—the ant build file is executed and a Squish test is run. You can also do the squishtest first or use squishtest more than once in order to run multiple test suites.

CruiseControl XML Reference

This section provides an overview of the tags that can be used after installing the CruiseControl plugin.

squishtest

The squishtest tag can be used to run Squish test cases or a test suite. The table below shows the attributes that can be used:

AttributeDescriptionRequired
suiteThe absolute path to the Squish suite that is to be run.Yes
testcaseDeprecated The one test case from the suite to be run, available for backwards compatibility only. Leave this attribute out to run the complete test suite. To specify which test cases should be executed explicitly use the testcase element instead.No
pathThe absolute path to Squish's root directory.Only if not set in the squishtest tag.
hostThe hostname of the machine where the squishserver is running. Leave this parameter out to let the plugin start the squishserver automatically.No
portThe port number that the squishserver is listening on. Leave this parameter out to let the plugin start the squishserver automatically.No
snoozeFactorThe snooze factor to use when running Squish tests, defaults to 1.No
reportdirDeprecated The directory where test reports should be output to, available for backwards compatibility only. To generate reports use the report element instead.No
resultdirThe absolute path to a directory which is used to save test results, corresponds to the squishrunner's --resultdir which is documented at Executing a Test Case (Advanced).No
webbrowserWhen executing a web test the browser to be used. Supported values are listed at the squishrunner's --webbrowser option at Executing a Test Case (Advanced).No
webbrowserargsWhen executing a web test the command line arguments passed to the used browser.No
failOnVerificationFailIf set to 'yes' the build will be marked as failure if Squish verifications fail or an error occurred inside the test execution. Defaults to 'no'.No

Note: When the attributes mentioned in the table are set in the Squish plugin binding tag, they act as default values. This means that the attributes are inherited from the plugin tag and can be overridden if necessary in the squishtest tag.

testcase

The testcase tag can be used to specify which test cases should be executed explicitly. It must be a child of the squishtest tag.

AttributeDescriptionRequired
nameName of the test case to be executed.Yes

Here is an example of using the testcase tag in a CruiseControl configuration file:

<cruisecontrol>
  <project name="connectfour">
    ...
    <schedule interval="300">
      <composite>
        <ant anthome="${env.ANT_HOME}" buildfile="projects/${project.name}/build.xml" />
        <squishtest
          suite="C:\Squish\examples\qt\addressbook\suite_py"
          path="C:\Squish">
          <testcases>
            <testcase name="tst_adding" />
            <testcase name="tst_general" />
          </testcases>
        </squishtest>
      </composite>
    </schedule>
    ...

report

The report tag can be used to specify which reports should be generated. It must be a child of the squishtest tag.

AttributeDescriptionRequired
formatReport format to be generated. Supported values are listed at the squishrunner's --reportgen option at Executing a Test Case (Advanced).Yes
fileThe absolute path to a file which the report is written to.Yes

Here is an example of using the report tag in a CruiseControl configuration file:

<cruisecontrol>
  <project name="connectfour">
    ...
    <schedule interval="300">
      <composite>
        <ant anthome="${env.ANT_HOME}" buildfile="projects/${project.name}/build.xml" />
        <squishtest
          suite="C:\Squish\examples\qt\addressbook\suite_py"
          path="C:\Squish">
          <testcases>
            <testcase name="tst_adding" />
            <testcase name="tst_general" />
          </testcases>
          <reports>
            <report format="xml2.2" file="C:\xml_reports\addressbook.xml" />
            <report format="xmljunit" file="C:\junit_reports\addressbook.xml" />
          </reports>
        </squishtest>
      </composite>
    </schedule>
    ...

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.