testomatic
is a simple CLI tool which:
- Watch test files thanks to a configurable regular expression which match the filenames
- Execute a command of your choice when a file watched is saved (
go test
for example) - Display a desktop notification indicating if your command succeeded or failed (see screenshots)
- You can continue coding without switching windows / terminal to see if your test passed!
Installation Configuration file Examples Contributing Disclaimer
You can find the releases of testomatic here: Github releases
Here an easy way to install testomatic on Linux using your favorite shell:
cd /usr/local/bin && sudo curl -LO https://github.com/Phantas0s/testomatic/releases/download/v0.2.2/testomatic && sudo chmod 755 testomatic && cd -
You can now normally run testomatic
from anywhere.
testomatic need a valid yaml
configuration file. The best is to create a .testomatic
file at the root of your project.
You can as well use a different name for the configuration file: in that case you can run testomatic --config my-config-name.yml
The configuration file can change the behavior of testomatic
drastically to adapt it to your needs. Here the details:
watch:
root: src/Tests
regex: "Test.php"
ignore:
- vendor
- cache
ignore_hidden: true
command:
bin: docker-compose
scope: current
ignore_path: true
abs: false
options:
- exec
- "-T"
- 'php'
- bin/phpunit
notification:
disable: false
img_failure: /home/superUser/.autotest/images/failure.png
img_success: /home/superUser/.autotest/images/success.png
regex_success: ok
regex_failure: fail
display_result: true
attribute | value | value type | required | default |
---|---|---|---|---|
root | The root folder where your tests are. testomatic will watch into this folder and every subfolders recursively. |
string | yes | empty |
regex | Every filename matching this regex will be watched. | string | yes | empty |
ignore | Files or folders you want to ignore (vendor for example) | array | no | empty |
ignore_hidden | Any files or folders beginning by a point . won't be watched |
boolean | no | false |
attribute | value | value type | required | default |
---|---|---|---|---|
bin | Path of the command line interface to execute | string | yes | empty |
scope | The command use the path of the saved file(current ), the directory of the saved file (dir ) or simply the root folder defined in watch (all ) as argument |
string - current , dir , all |
yes | empty |
abs | Use the saved file absolute path instead of the relative one | boolean | no | false |
ignore_path | Doesn't use the path of the file saved as command line option | boolean | yes | false |
options | Options to pass to the command line interface | array | no | empty |
attribute | value | value type | required | default |
---|---|---|---|---|
disable | Disable the desktop notifications | boolean | no | false |
img_failure | Path of image displayed when test is failing | string | no | empty |
img_success | Path of the image displayed when test is a success | string | no | empty |
regex_success | If the result of the command match this regex, the test is a success | string | yes | empty |
regex_failure | If the result of the command match this regex, the test is a failure | string | yes | empty |
display_result | Display the return of the command in the notification box | boolean | no | false |
You will find in the folder examples
tested configuration files for running PHPUnit
and go test
.
I included in the php
examples how to run tests in docker using docker-compose
with or without notifications.
The notification is displayed with a text and image of your choice when saving the test
The result of the test is displayed in a terminal
Pull request is the way ;)
- I only tested
testomatic
on Linux (Arch linux). It works on MacOS too (thanks @midnightrun). - You can use testomatic to run
Golang
andPHPUnit
tests automatically. The configuration should be flexible enough for you to use it with other test frameworks / languages.
testomatic is under the MIT License