Categorygithub.com/Phantas0s/testomatic
modulepackage
0.2.2
Repository: https://github.com/phantas0s/testomatic.git
Documentation: pkg.go.dev

# README

testomatic logo

testomatic is a simple CLI tool which:

  1. Watch test files thanks to a configurable regular expression which match the filenames
  2. Execute a command of your choice when a file watched is saved (go test for example)
  3. Display a desktop notification indicating if your command succeeded or failed (see screenshots)
  4. You can continue coding without switching windows / terminal to see if your test passed!

Menu

Installation
Configuration file
Examples
Contributing
Disclaimer

Installation

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.1/testomatic && sudo chmod 755 testomatic && cd -

You can now normally run testomatic from anywhere.

Configuration file

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

watch

attributevaluevalue typerequireddefault
rootThe root folder where your tests are. testomatic will watch into this folder and every subfolders recursively.stringyesempty
regexEvery filename matching this regex will be watched.stringyesempty
ignoreFiles or folders you want to ignore (vendor for example)arraynoempty
ignore_hiddenAny files or folders beginning by a point . won't be watchedbooleannofalse

command

attributevaluevalue typerequireddefault
binPath of the command line interface to executestringyesempty
scopeThe 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 argumentstring - current, dir, allyesempty
absUse the saved file absolute path instead of the relative onebooleannofalse
ignore_pathDoesn't use the path of the file saved as command line optionbooleanyesfalse
optionsOptions to pass to the command line interfacearraynoempty

notification

attributevaluevalue typerequireddefault
disableDisable the desktop notificationsbooleannofalse
img_failurePath of image displayed when test is failingstringnoempty
img_successPath of the image displayed when test is a successstringnoempty
regex_successIf the result of the command match this regex, the test is a successstringyesempty
regex_failureIf the result of the command match this regex, the test is a failurestringyesempty
display_resultDisplay the return of the command in the notification boxbooleannofalse

Examples

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.

Screenshots

The notification is displayed with a text and image of your choice when saving the test testomatic example success

Too many go here testomatic example failure

The result of the test is displayed in a terminal testomatic example terminal result

Contributing

Pull request is the way ;)

Disclaimer

  • I only tested testomatic on Linux (Arch linux). It might not work on macOS or Windows.
  • You can use testomatic to run Golang and PHPUnit tests automatically. The configuration should be flexible enough for you to use it with other test frameworks / languages.

Licence

testomatic is under the MIT License

# Packages

No description provided by the author