Although you can write test templates in Javascript, we highly recommend writing your templates in Typescript to make everything more seamless. A Test Template has 3 Components:Documentation Index
Fetch the complete documentation index at: https://docs.metlo.com/llms.txt
Use this file to discover all available pages before exploring further.
- name - A name for your template
- version - The version for your template
- builder - A function that takes an endpoint and returns a TestBuilder
TypeScript
Builder
A builder is a function that takes an endpoint of type GenTestEndpoint.TypeScript
TestBuilder
Think of the test builder class as building up a YAML test file piece by piece by chaining the following functions:setMeta - Adding Metadata
Use this function to add any metadata related to your test, generally you would
want to add a name and severity.
TypeScript
addToEnv - Adding Environment Variables
Add any environment variables you want to use later in your test.
TypeScript
addTestStep - Adding a Test Step
Use this function to add each request, along with its extractors and and
assertions.
TypeScript
TestStepBuilder
TheTestStepBuilder builds a request along with its assertions and extractors. You instantiate a test step builder with the request that you want to create:
TypeScript
TypeScript
TypeScript
assert - Add an Assertion
Use this function to add an assertion to your test step.
TypeScript
extract - Add an Extractor
Use this function to add an extractor to your test step.
TypeScript