17.4. CruiseControl integration

17.4.1. Obtaining the CruiseControl Plugin
17.4.2. Installing the CruiseControl Plugin
17.4.3. Using the CruiseControl Plugin
17.4.4. CruiseControl XML reference

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.

17.4.1. Obtaining the CruiseControl Plugin

The CruiseControl plugin is available from: www.froglogic.com/download/squish-cc-plugin_latest.jar.

17.4.2. Installing the CruiseControl Plugin

To install the plugin simply copy the jar file to CC_HOME\lib.

17.4.3. Using the CruiseControl Plugin

Here is the example used in the CruiseControl distribution:


<cruisecontrol>
    <project name="connectfour">

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

        <bootstrappers>
            <antbootstrapper anthome="%%APACHE_ANT%%" 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="%%APACHE_ANT%%" 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:

<?xml version="1.0" encoding="UTF-8"?>
<cruisecontrol>

  <project name="connectfour">
  
    <plugin name="squishtest" path="C:\squish"
    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="%%APACHE_ANT%%" buildfile="projects/${project.name}/build.xml"/>
  
               <squishtest suite="C:\squish\examples\qt3\suite_addressbook_js" testcase="tst_add_address"/>
           </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. Note that it is also possible to do the squishtest first or to use squishtest more than once in order to run multiple test suites.

17.4.4. CruiseControl XML reference

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

17.4.4.1. squishtest

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

Table 17.3. squishtest tag

Attribute Value Required
suite The absolute path to the Squish suite that is to be run. Yes
testcase The one test case from the suite to be run. (If this is not specified then all of the suite's test cases will be run.) No
path The absolute path to Squish's root directory. No
host The hostname of the machine where the squishserver is running. No
port The port number that the squishserver is listening on. No


[Note]Note

When the attributes mentioned in the table are set in the Squish plugin binding tag, they act as default values. So in the plugin binding listed in the previous section, the path is set to a default of "C:\squish". The same can be done for the other attributes—for example, to set the default host and port. This means that the attributes are inherited from the plugin tag and can be overridden if necessary in the squishtest tag.