"Infinitest" with the XP Framework

at 2012-06-30 in Unittests by friebe (0 comments)

Thinking about our upcoming 5.8.6 release whose focus is on unittesting, I recently came up with the idea to have unittests run whenever I change, and save, the code I'm working on (yesterday evening I found out in the Java world this is called "infinitest" - my focus though was to get this done on the command line, without the necessity to plug in to various IDEs).

Searching for utilities to monitor the file system for changes, I found the "inotify tools". Since I work on Windows using Cygwin though, I decided to "port" them using the .NET Framework's FileSystemWatcher class. The results can be found here (just clone and run "make" - prerequisites are .NET Framework v3.5).

Given this, the basic command line is:

  $ inotifywait -r -m src/ | while read line ; do \
# The action to be executed when files are modified inside the "src"
# directory or any of its subdirectories
done

Extending this example to run unittests is easy, especially with unittest now accepting paths as command line argument. Last but not least, we use an additional listener to update the xterm or xterm compatible shell's title with the progress and the "executive summary" later on, so we only have to glance at the console's title bar to see what's going on.

Screenshot
infinittest for XP running in a mintty window

Putting it all together, we now end up with the following command line:
  $ inotifywait -r -m src/ | while read line ; do \
unittest -l xp.unittest.XtermTitleListener - src/ ; \
done

Pretty cool, I'd say!:-)



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES

Related

Find related articles by a search for «"Infinitest"».