Search code examples
yuicruisecontrol

Integrating YUI tests with CruiseControl


I am using YUI to test my JavaScript app, and want to integrate the test results into my CruiseControl build system. How can I use CruiseControl to run the tests? I initially thought about using the JUnit plugin to drive the tests, but that is a no go.

Does anyone else have this working?

(Please note: Changing either YUI or CruiseControl isn't an option for me.)


Solution

  • My solution, in the end, is a bit of a hack.

    • I modified our test runner HTML page to post the test results (the entire XML object that it creates) to a PHP page, then to close itself.
    • I added a PHP page to the build server (with a PHP processor attached to an Apache HTTPD instance) to accept the posted XML document and save it to disk.
    • The unit tests are now run by a 'test driver', which fires up a browser with the test runner HTML page, and waits for the browser process to end.

    This gets the output of the tests onto the local disk of the build server. I then merge the output file into the CC log by adding the following to the project configuration:

    <log>
        <merge file="path_to_file" />
    </log>
    

    There are a few drawbacks, but are (currently) willing to live with them:

    • Had to introduce a test runner app to the infrastructure
    • Had to add an Apache server and PHP processor to the build machine
    • Because only IE will allow a browser page to close itself without a user prompt, the build server must be a Windows machine.