- Simple
GETrequests inline as a test step cURLrequests that run before the test starts (pre-requests)
Inline GET requests
You can make aGET request directly in a test step and use the response data in subsequent steps.
Example: retrieving an OTP code
Assuming there is an endpoint to retrieve an OTP code:otp_code from the response. Step 2 uses the extracted value by referencing it as “remembered”. You can use environment variables (e.g. {{env.username}}) as part of the URL.
For more complex requests like POST or DELETE with payloads, use pre-requests instead.
Pre-requests (cURL)
Pre-requests let you executecURL commands before the test starts. This is useful for setup tasks like cleaning data, creating test accounts, or fetching credentials.
Step 1: Define the cURL commands
Navigate to the Settings tab within your test. In the Pre-requests section, define one or morecURL commands that will be executed sequentially before the test runs.
Examples:
Step 2: Define values to remember
If a pre-request returns values you want to use in the test, name them in the pre-request settings. A name is a JSON key, a path into the response, or a path that indexes an array along the way. Given this response:user.username, user.password and ads.0.id are all usable names. Nested objects do not need flattening.
The value is then referenced by the last segment of its name, so user.username is remembered as username and ads.0.id as id. Two values that end in the same key would collide, so give one of them a name of its own upstream if your response has, say, both a user.id and an ad.id.
Platform tests name a remembered value by its whole path instead, as
MB_PRE_USER_USERNAME, which lets one test carry both a user.id and an
ad.id. See Setup and cleanup calls.
