Advanced Tests
Resp Object
You probably want to make assertions on things other than the response status! The entire response object looks like this:
Complex Assertions
If you want to write more complex assertions you can use Javascript expressions
instead of specifying a key
and a value
. If the expression resolves to a
truthy value the assertion will pass, otherwise it will fail.
Environment Variables
You can specify environment variables in your test file to reuse values across
your test. In this example we make an environment variable called CREDENTIALS
.
It can then be used anywhere in the test by using the string {{CREDENTIALS}}
.
Extractors
Instead of specifying an environment variable at the top level, you might want to dynamically create environment variables in each step of the test. You can do this with extractors.