probably icon indicating copy to clipboard operation
probably copied to clipboard

tab-completion for command-line operation

Open propensive opened this issue 5 years ago • 0 comments

Probably provides the Suite type as a simple way of creating a test runner application which can be invoked from a shell. Issue #30 proposes adding several command line options to Probably's runner, plus it should be possible to specify one or more specific tests to run (rather than all of them), each specified by its hash.

It would be useful to have a simple command-line application which can run these tests automatically from the command-line.

For a test runner to work, it needs to a) invoke Java, b) on the correct Suite class, c) with the correct classpath. If the tests are run once (e.g. from inside a build tool), these details can be obtained from the successful run. For example, System.getProperty(java.home) should give the path to the Java executable, and getClass.getClassLoader.asInstanceOf[URLClassLoader].getUrls should give the classpath that was used to run the tests. These can be stored in a hidden file (e.g. .probably) in the working directory, storing these values as the first three lines of the file (to keep things as simple as possible).

A shell script—let's call it probe—which we write can then read this file, and invoke Java to run these tests directly from the command line.

A successful run of the tests could rewrite this .probably file to additionally list the hashes of all the tests with their names, for example:

ab67f3:this is the name of the test
8812cb:here is another test

which would enable tab-completions scripts for bash, zsh and/or fish to read the contents of this file and offer tab-completion (additionally with the test name on zsh and fish, which support this) on the test names.

Only assert-style (not check-style) tests should be included in the file, because they're the only ones which can turned on or off.

If #30 is implemented, then command parameters should additionally be included in the tab-completion script(s).

This is quite a complex issue, so it's worth having a chat with @propensive before starting.

propensive avatar Nov 28 '20 13:11 propensive