Page
Library
Module
Module type
Parameter
Class
Class type
Source
CRAM is a is functional testing framework for command line applications. craml
is freely inspired by the Python tool, which was itself based on Mercurial's unified test format.
craml
is released as a single binary (called craml
) and supports the following syntax:
Multi-lines commands end by \
and continue with two spaces and a >
sign on the next line:
$ <line1> \
> <line2> \
> <line3>
...
. These will match any possible outputs (on zero, one or multiple lines).<--
are command pre-conditions; they will determine the conditions where the command is run. Currently, only non-deterministic modes are supported as pre-conditions (see below).-->
are command post-conditions. Currently, only exit codes are supported as post-conditions (see below).To run the tests described in a <file>
, use craml <file>
. This will run all the commands in sequence and will generated <file>.corrected
if one of the output do not match the expected command outputs.
craml
supports non-deterministic outputs:
<-- non-deterministic
$ <command>
<output>
In that case, craml <file>
will run the command but will not generate <file>.corrected
if the new output differs from the one described in the file. Use craml --non-deterministic <file>
to come back to the default behaviour.
craml
supports non-deterministic outputs:
<-- non-deterministic [skip]
$ <command>
<output>
In that case, craml <file>
will not run the command. Use craml --non-deterministic <file>
to come back to the default behaviour.
craml
tests exit codes:
$ <command>
<output>
--> exit 10
If <command>
does not exit with code 10, then craml <file>
will generate <file>.corrected
with the right exit code. Note that @@ exit 0
will not be displayed.