A set of command-line tools for rapidly testing and analyzing various TRAPI resources.
Install fx: https://fx.wtf/install
This project uses Poetry for package/dependency management. Install instructions: https://python-poetry.org/docs/
Clone and set up workspace:
git clone https://github.com/biothings/trapi-testing-tools
cd trapi-testing-tools
poetry install
# Get into the virtual environment
poetry shell
All usage is documented in the --help
option of the program:
tt --help
Individual subcommands also provide help:
tt test --help
To run a full test of everything in the routine folder, against your local instance, viewing only failed tests:
tt test -a -d -e bte.local
You can run the command tt test
with no other arguments to interactively select tests. If you know the test(s) you want to run, you can provide them as arguments:
tt test trapi-testing-tools/queries/routine/feature/creative/drug_treats_disease.hurl
A tool exists for retrieving responses from a PK:
tt pk <your-pk-here>
For more information, see tt pk --help
You can add your own queries to be used in tt test
, the specification is relatively simple:
# Some tests are provided for validating the response
from trapi_testing_tools.tests import http
method = "POST" # Use any HTTP method here
endpoint = "/v1/query" # The endpoint to be applied to the tool
params = {...} # You can optionally pass URL parameters as a dictionary of param_name: value
body = {...} # You can optionally add a body in the form of a dictionary
tests = [http.status(200)] # You can optionally set tests to validate the response
Queries placed under the trapi_testing_tools/queries/routine
directory will be run when tt test
is invoked with the option --all
you can instead supply a list named steps
with the above values as dictionary entries if you need to test consecutive related queries. See trapi_testing_tools/queries/routine/feature/caching/cache.py
for a good example.
Services are specified in config.yaml
. See the bte entry for an example.
Services are selected either interactively or by adding -e <service>.<level>
to the command. You can change the default service so you can more quickly type just the level when supplying the option to the command.