Skip to content

Example Test Other Things Than Executable Files

Emil Karlén edited this page Sep 13, 2020 · 5 revisions

The "actor" is responsible for executing the act phase - the contents of [act]. It is set in [conf] by the actor configuration parameter.

Exactly supports a couple of such "actors".

Testing a shell command line

The default actor is "command line". Preceding the command with a $ specifies that the rest of the line is a shell command line:

[act]

$ echo 'Hello, World!'

[assert]

stdout equals <<EOF
Hello, World!
EOF

Testing interpreted source files

The "file interpreter" actor interprets a source file.

An interpreter must be specified, by giving an executable file. The interpreter may be a file located on the PATH:

[conf]

actor = file % python

[act]

my-argument-printer.py 'an argument' more arguments

[assert]

stdout equals <<EOF
Argument 1: an argument
Argument 2: more
Argument 3: arguments
EOF

Testing properties of the system environment

A test case does not need to have an act phase. In that case, the "null" actor is used.

This can be used to test existence of files and directories etc.

But the test case is still executed in a temporary sandbox directory. This means that file names must not be relative the current directory.

-rel-act-home may be used to refer to files relative the location of the test case file.

For example, if the following test case is located in a file null-actor-example.case, then it will PASS:

[assert]

exists -rel-act-home null-actor-example.case : type file

act-home can be set to a different directory if that is more convenient.

[conf]

act-home = /etc

[assert]

exists -rel-act-home passwd : type file

Clone this wiki locally