Using iWatch to Automatically Run Unit Tests (Linux)

RustyRazorblade Consulting RustyRazorblade Consulting
1 min read

iWatch is a perl script that uses inotify to monitor files directories. It’s similar to the watch tool, which can do all sorts of stuff if the files or directories it’s watching are modified or affected in pretty much any way at all.

Install iWatch

apt-get install iwatch

I’ve got this 1 liner in a file to quickly watch my directory and execute a PHP unit test .

#!/bin/bash
iwatch -c "phpunit $1" -t '.*php$' -r -v -x ./.git -e modify .

I run this with a my argument (a unit test) and then sit there and code away. When I save, it detects the change and automatically runs my test. It’s pretty awesome.

iWatch is a perl script that uses inotify to monitor files directories. It’s similar to the watch tool, which can do all sorts of stuff if the files or directories it’s watching are modified or affected in pretty much any way at all.

Install iWatch

apt-get install iwatch

I’ve got this 1 liner in a file to quickly watch my directory and execute a PHP unit test .

#!/bin/bash
iwatch -c "phpunit $1" -t '.*php$' -r -v -x ./.git -e modify .

I run this with a my argument (a unit test) and then sit there and code away. When I save, it detects the change and automatically runs my test. It’s pretty awesome.

RustyRazorblade Consulting

RustyRazorblade Consulting

Apache Cassandra Consultant and Distributed Systems Expert

Related Posts

Need Expert Help with Apache Cassandra?

Get professional consulting for your distributed systems challenges. Performance optimization, architecture design, and troubleshooting.