Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I typically work with CruiseControl for PHP testing (using CC's <a href="http://phing.info" rel="nofollow noreferrer">Phing</a> support, not phpundercontrol). I have only worked with Hudson a little, but have gotten Hudson to successfully record phpunit tests using phing's phpunit support.</p> <p>The following instructions assume that you will be using Phing (not Ant) to manage your PHP project builds and that you have the necessary prereqs installed. It also assumes you have PHPUnit 3 installed (though PHPUnit 2.x should work too).</p> <p><em>Step 1: Setup Project for Phing/PHPUnit</em></p> <p>First you need to make sure that your project is testable using Phing. Here's a sample Phing build.xml that runs unit tests and creates a JUnit-compatible XML output.</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;project name="Test Project" default="test"&gt; &lt;property name="tests.dir" value="." /&gt; &lt;property name="reports.dir" value="${tests.dir}/reports" /&gt; &lt;target name="test" description="Run PHPUnit tests"&gt; &lt;phpunit haltonerror="true" haltonfailure="true" printsummary="true"&gt; &lt;batchtest&gt; &lt;fileset dir="${tests.dir}"&gt; &lt;include name="**/*Test.php" /&gt; &lt;/fileset&gt; &lt;/batchtest&gt; &lt;formatter type="plain" usefile="false" /&gt; &lt;formatter type="xml" usefile="true" todir="${reports.dir}" outfile="test-results.xml" /&gt; &lt;/phpunit&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p><em>Step 2: Setup Hudson</em></p> <ol> <li>Install the Phing plugin for Hudson. Note that you <em>may</em> need to install Phing as a standalone pacakge (I put it in /opt/phing-2.3.3) and configure PHING_HOME in Hudson config to point to that directory. You should also be able to use the PEAR-installed Phing; however, I have not tested that.</li> <li>Configure Hudson to build your project using Phing.</li> <li>Configure Hudson to collect JUnit tests from your project. The name of our results file will be test-results.xml. In the example above you'd configure it to collect files from reports/*.xml.</li> </ol> <p><em>Step 3: Build!</em></p> <p>That should do it. Try building your project now. Hopefully it will collect the results. </p> <p>Also see this <a href="http://www.slideshare.net/hozn/phing-building-with-php" rel="nofollow noreferrer">Phing presentation</a>, or this <a href="http://www.slideshare.net/hozn/putting-phing-to-work-for-you" rel="nofollow noreferrer">Phing presentation</a> for more on Phing and (to a lesser extent) PHPUnit integration.</p> <p>Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload