api-watchdog discover path/to/test/files
Will output the abbreviated result of the tests to stdout.
api-watchdog discover --email path/to/test/files
Will email the results of the tests to the relevant addresses
(as determined by the email_to=
field of the test. Test results
are grouped so that only one email per address is sent per run.
Whjen using the CLI, these environment variables must be set to email results
api-watchdog discover -o results_file.json path/to/test/files
Will serialize the WatchdogResultGroup
object to the path specified
by the -o
flag.
pip install api-watchdog
To run within Docker you can use the following command:
docker build -t api-watchdog .
docker run -e MAILGUN_API_URL=X -e MAILGUN_API_TOKEN=X -e MAILGUN_FROM=X api-watchdog api-watchdog discover path/to/test/files
To run tests within Docker you can use the following command:
docker build -t api-watchdog .
docker run api-watchdog python -m unittest discover tests
The main way you'll interface with API Watchdog is through WatchdogTest
s.
Each WatchdogTest
has
An Expectation
describes where to find a piece of data in the response and what that piece of data should be in order for the test to pass.
Each Expectation
has
One of the strings:
WatchdogTest
.The selector format is a string that is a jq program. This allows for rich selection capabilities. For example:
{
"selector": ".message.knowledge_graph.nodes[\"MONDO:0005148\"].name",
"value": "type 2 diabetes mellitus",
"validation_type": "string"
},
Is an Expectation
that checks if a node is present in the knowledge graph of a TRAPI response.
The possible validation types are
An API monitoring utility that aspires to support: