Writing a Test
You can write tests for your endpoints in a simple YAML based DSL. These tests can be run using either the CLI or inside Metlo’s UI.
Creating a New Test
To create a new test make a new yaml file (i.e. user_endpoint_test.yaml
).
1. Define Metadata
The first step is to define some metadata for your test:
- id - A unique id for your test. This can be any string that matches the
pattern
[A-Za-z0-9-_]+
- meta.name [optional] - A name for your test
- meta.severity [optional] -
LOW | MEDIUM | HIGH | CRITICAL
- meta.tags [optional] - A list of tags for your test
2. Add your Test
A test is a set of steps, where each step has an HTTP request and a set of
assertions. Heres an example of a test that sends a GET
request to
https://example.com and verifies that the response status
is 200
and the content length header is "648"
.
All the fields in the resp
object are documented
here
You can also specify query params, headers and data for a request.
A complete test might look something like this:
Run a Test
You can run your test with the Metlo CLI:
Making a Test in Metlo’s UI
You can make a test in Metlo’s UI on the tests tab on the endpoint page.