Set up tests for REST in seconds with YAML
Install Strest using
yarn global add strest-cli
npm i -g strest-cli
To test something, you have to create a REST-API first. If you already have an API to test, you can skip this step.
We’ll be using the postman-echo test API in this tutorial.
To get started, create a file called
tutorial.strest.yml (The extension needs to be
version: 1 # only version at the moment requests: # all test requests will be listed here testRequest: # name the request however you want url: https://postman-echo.com/get # required method: GET # required data: # valid data types: params + json or raw params: foo1: bar1 foo2: bar2 # log: true # uncomment this to log the response
No more configuration needed, so you’re ready to go!
To run the test, open your terminal and type
You may also run multiple test files at the same time by pointing to the directory, where the files are stored
strest # this will recursively search for all .strest.yml files in the cwd and it's subdirectories # or strest someDir/