I've been wanting to develop a node.js module for a while. I finally got round to doing so last weekend.
What is phpunit-testrunner?
phpunit-testrunner is a very simple automatic testrunner, inspired by karma another testrunner for javascript. It was designed to automatically run your phpunit test suite when you modify a file, making it very handy to see the effect of a file change on the rest of your codebase.
Why is it important?
Test-Driven Development (TDD) teaches us to write tests first. Every step in the test-implement cycle, includes a continuous 'run test' step.
The phpunit-testrunner
removes the need to run your test suite every time you modify a file (or add a new file). This makes development that one step easier. With realtime updates, you should immediately see the effects of any change made.
How does it work?
It works by watching a bunch of files (or directories). When any of those files are modified (or a new file is added to the directory being watched), phpunit-testrunner
will automatically execute phpunit using the command options your provide.
Installation
$ npm install -g phpunit-testrunner
Usage
- Firstly, you'll need to create a config file. The config file should have an object with the following parameters:
rootPath
[string]fileOrDirectoriesToWatch
[array] of directories/filescommandArguments
[array] of phpunit command line arguments
{ "rootPath": ".", "fileOrDirectoriesToWatch": [ "src/Acme" ], "commandArguments": [ "-c", "app/phpunit.xml", "--testsuite", "TestSuite" ] }
- Execute the testrunner
$ phpunit-testrunner -c path/to/configuration/file.js
If you have any issues using the testrunner please report an issue on the Github Issues Page