Functional testing tool
Project description
Refery
Refery is a functional test tool written in Python.
Install
$ ./setup.py install
Usage
usage: refery [-h] -f <path> [--verbosity <verbose|silent|normal>] [--junit-file <path>]
options:
-h, --help show this help message and exit
-f <path>, --test-file <path>
Path to the YAML test file.
--verbosity <verbose|silent|normal>
Output's verbosity, defaults to 'normal'.
--junit-file <path> Optional path to a JUnit XML file in which to write the output
As you can see, refery's only mandatory argument is a path to the YAML file
describing the collection of test suites to be run.
Writing tests
Individual tests are represented by test cases and a test suite is a collection of test cases.
Test suites
Test suites are a given as a
YAML sequence which is the
value associated to the
YAML mapping key testsuites.
Each test suite is a YAML mapping which accepts the following fields:
| Field | Description | Optional |
|---|---|---|
name |
Name of the test suite. | ❌ |
tests |
YAML sequence containing the test cases. | ✅ |
setup |
Command to execute before each test case. | ✅ |
teardown |
Command to execute after each test case. | ✅ |
fatal |
Indicates if a failure in a test case means an abortion of the runner. Defaults to false. |
✅ |
Test cases
Each test case is a YAML mapping accepting the following fields:
| Name | Description | Optional |
|---|---|---|
name |
Name of the test case. | ❌ |
binary |
Path to the tested executable. | ❌ |
args |
YAML sequence containing the arguments passed to the executable. | ✅ |
ref |
Path to an executable with the desired behaviour. | ✅ |
stdin |
String passed as standard input. | ✅ |
stdout |
Expected standard output. | ✅ |
stderr |
Expected standard error. | ✅ |
exit_code |
Expected exit code. | ✅ |
skipped |
Boolean indicating whether the test case shall be ignored. | ✅ |
timeout |
Timeout in seconds, after which the test case is stopped marked as failed. | ✅ |
stdout_mode/stderr_mode |
The testing mode of the two output streams. Can be of two kinds:
stdout_mode and stderr_mode default to strict. |
✅ |
If the ref is specified, it is used to test the standard output, standard
error and exit code. If any of these fields is specified, they take precedence
over ref.
For example, take the following test case:
hello:
ref: bin/hello.sh
exit_code: 0
The stdout and stderr are tested according to bin/hello.sh but the exit
code must be equal to 0, no matter what is actually returned by
bin/hello.sh.
Default value
An optional YAML mapping can be used to specify default values for all test
cases. It must be passed as a value to the default key and can contain all
fields accepted by test cases. For each test case, if a field is already
defined, the one defined in the test case takes precedence.
Here is an example of a valid input file :
default:
binary: my_hello.sh
ref: bin/hello
stderr_mode: exists
testsuites:
- name: hello
fatal: true
tests:
- name: simple_hello
- name: hello_with_name
timeout: 1
args:
- John Doe
- name: goodbye
tests:
- name: bye
ref: bin/goodbye
timeout: 1
args:
- --bye
- John Doe
This defines two test suites, the first containing two test cases and the second only one.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file refery-2.0.1.tar.gz.
File metadata
- Download URL: refery-2.0.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b674d5a90b4c2b5ebdbc99542484efe4c97299968b924782540f1446b238d81d
|
|
| MD5 |
4620e5e34fcd4a0968a4eb90fb2ed8b6
|
|
| BLAKE2b-256 |
8302b7bb0fcc7daff107ea1ad02d6fd3b3c2c1cafb31f1c3fd02b905a17fa2a9
|
File details
Details for the file refery-2.0.1-py3-none-any.whl.
File metadata
- Download URL: refery-2.0.1-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6a9bfb8a91785845e99253e9d38a549f49a602b4526693f95028ec3ee5b44cc
|
|
| MD5 |
4a9278d93113e3c90e9551cb07705820
|
|
| BLAKE2b-256 |
f80b4891391727434f48d0074571a0bcbf829f426b9d958462a50b22f0434f02
|