This project is a Phing build tool task for running QUnit tests headless with PhantomJS
This project has been tested with
To use this task, add the classpath where you placed the QunitTask.php in your build.xml file:
<path id="project.class.path">
<pathelement dir="dir/to/qunittaskfile/"/>
</path>
Then include it with a taskdef tag in your build.xml file:
<taskdef name="qunit" classname="QunitTask">
<classpath refid="project.class.path"/>
</taskdef>
You can now use the task
<target name="qunit" description="Javascript Unit Test">
<qunit executable="DISPLAY=:0 /path/to/phantomjs" haltonfailure="true" runner="${basedir}/tests/run-qunit.js">
<fileset dir="${basedir}">
<include name="tests/runner.html" />
</fileset>
</qunit>
</target>
There are no required attributes.
- runner - Specifies the qunit runner, look at run-qunit-example.js
- executable - Path to phantomjs command.
- haltonfailure - If the build should fail if any test fails.