Testy was created to assist in TDD, as well as to remind a lazy developer to use tests. Testy monitors a directory for changed files and will run the appropriate test.
Testy might be used, to execute an arbitrary command or application, e.g. php-codesniffer, php-hint, etc.
Example w/o File to Test-Mapping
"testy": { "path": "~/workspace/testy", "test": "phpunit", "test_dir": "~/workspace/testy;", "syntax": "php -l $file", "find": "*.php" }
Example with File to Test-Mapping
"testy": { "path": "~/workspace/testy", "test": "phpunit $file {Testy|Tests} {.php|Test.php}", "test_dir": "~/workspace/testy;", "syntax": "php -l $file", "find": "*.php" }
Example with File to Test-Mapping & Syncing
"testy": { "path": "~/workspace/testy", "test": "phpunit $file {Testy|Tests} {.php|Test.php}", "test_dir": "~/workspace/testy;", "sync_dir: { "from": ~/workspace/testy, "to": ~/not-a-vdisk/testy, }, "syntax": "php -l $file", "find": "*.php" }
- path: The path that is checked for changed files
- find: The find-pattern that is used to find changed files
- syntax: Command to do a syntax-check (skips testing on error)
- test_dir: The dir to cd in, before executing the test-command (which is also checked for changes)
- sync_dir: rsync the project to this directory, replace all paths with 'to'
- from: The source
- to: The target
- repeat: Repeat the test-command without the specific file (which is replaced by ''), default: true
- test: The test to execute on changed files
- placeholders:
- $file Each file that changed
- $project The projects name
- $time The current timestmap
- $mtime The modification's timestamp
Testy supports several ways to notify the developer about the result of the executed command:
- Stdout, which simply prints the output
- File
- Dbus
- Growl, which works well with snarl on windows
- Libnotify, which used notify-send
Testy uses hpbuniat/notifyy.
Use the {Search|Replace}-Pattern, as often as needed, to map the Source-File to it's test. If all Search-Patterns are found within the changed-files path, it is assumed that this is a test file.
The dbus-notifier is based on the php dbus-extension (https://pecl.php.net/package/DBus) by Derick Rethans