Running Tests¶
Basic Operation¶
Within a test module with a etr.yaml
configuration file etr
needs no arguments and can be
executed like this:
$ etr
Note
Use $ etr --help
to get details on command line options.
To run with more information, pass the -v
flag, which also can be passed more times for even
more verbose output like this:
$ etr -v
$ etr -vv
Note
Verbosity level 2 (-vv) provides many details that are targeting a developer of etr and some messages may be confusing. It is recommended for normal users to use verbosity level 1 (-v) for normal usage.
To execute a test in another directory use the -C
flag:
$ etr -C path/to/test/directory
Steps¶
etr
execution is separated into three steps:
setup - Aquisition of test resources. - Process jinja2 template files.
run - Run tests.
teardown - Release test resources.
By default all steps are executed but can also be controlled via the --step
option:
# Execute only the setup step
$ etr --step setup
# Execute only the setup and run steps to leave everything running so that run may be
# executed again
$ etr --step setup:run
# Execute tests again
$ etr -step run
Test Subsets¶
You can specify which tests from etr.yaml
to run with the test option:
$ etr --test <test>
$ etr -t <test>
for example:
$ etr -t src/tests.robot
The option may be specified multiple times:
$ etr -t src/tests1.robot -t src/tests2.robot
Cleanup Logs¶
Run etr clean
to cleanup logs, session information and more.
Caution
Take care to release acquired resources before doing this. Otherwise the locks will be lost and manual recovery will have to be made.
Resources are normally automatically released during during teardown. If that step was
excluded from execution this step can be manually executed with etr --step teardown
.
Additional Information¶
Orphaned Processes¶
Whenever etr
runs a test with e.g. Robot Framework it will set the environment variable
ETR_TRACE_ID
with a unique identifier. This identifier is normally inherited if further
processes are started from Robot tests. If not it’s recommended that the user propagate
ETR_TRACE_ID
manually.
After the test execution etr
will attempt to identify orphaned processes and perform cleanup as
necessary. This is done by inspecting the environment of processes owned by the same user that
invoked etr
. This means that no cleanup is performed if process changes uid or modifies the
environment to remove ETR_TRACE_ID
.
When cleaning up etr
will first send SIGTERM signal and if process does not exit it will send
SIGKILL after 6 attemps with a 1 second delay between attempts.
Exit Codes¶
etr
use the following exit codes:
EC |
Description |
---|---|
0 |
Success. |
126 |
Test runner reported failure. |
127 |
Error occurred during execution. This includes transient errors such as test resources could not be fetched. |
253 |
Aborted by user. |
255 |
Internal error. |