contact Me

Use the form on the right to contact me.

You are welcome, to contact me regarding the topics of this page, my open source projects, or my work. Please use the contact form and leave a valid email address for me to respond to.

Thank you.

Egidestr. 9
44892 Bochum
Germany

/brain/dump

Random thoughts, bright ideas and interesting experiments. In short the ramblings of a fulltime nerd.

 

js-test-driver Phing task

Jakob Westhoff

One of the projects I am currently developing is heavily javascript based. Therefore I needed a productively usable unit-testing framework for the javascript part of the application. As I am mainly developing in a terminal using vim, I wanted a solution which could run js tests from within a terminal shell.

jsttestddriver is a javascript unit-testing framework which does meet all my criterias. To be able to productively use this framework I needed to integrate it into the application build-process, which is controlled and run by Phing. Therefore I wrote a really simple Phing task to run the jsttestddriver runner from inside a Phing build file.

As I thought some of you might be in need of something like this, I decided to share this simple, but yet useful task.

Download

As the repository hosting the project this task has been developed for is not yet open to the public, I just uploaded the Phing task file, which can be downloaded below.

Usage example

The usage of the task is really simple. Just tell Phing where to find the newly task class and how the task is named. Then just use it supplying a jsttestddriver jar file, the javascript sources to be included and the testfiles to be run.

A simple buildfile using the jstestdriver task does look like this:

<?xml version="1.0"?>
<project name="some project" default="test" basedir=".">
<taskdef name="jstestdriver" classname="phing.tasks.jsTestDriverTask"/>

<target name="test">
<jstestdriver jar="tests/runner/JsTestDriver-svn-324-patched.jar">
<fileset dir="build">
<include name="build.js" />
</fileset>
<fileset dir="tests">
<include name="this/*.js" />
<include name="that/*.js" />
<include name="something_else/*.js" />
</fileset>
</jstestdriver>
</target>
</project>

Want to learn more about js-test-driver?

I will be giving a talk about jsttestddriver itself on Friday, 06. November at the PHP Usergroup CGN. Attendance is free and you are welcome to join us.