Create a test file
Create a file called This file defines three requests:
api.http:api.http
- getPosts — fetches all posts and checks the response is an array
- createPost — creates a new post and captures its ID
- getCreatedPost — uses the captured ID to verify the post was created
Run the tests
What Just Happened?
Let’s break down the key concepts from this example: Variables —@baseUrl defines a reusable variable, referenced with {{baseUrl}}.
Request separator — ### marks the start of each request.
Metadata — # @name, # @depends are directives that control behavior.
Assertions — The >>> ... <<< block contains expect statements that validate the response.
Captures — The >>>capture ... <<< block extracts values from responses for use in later requests.
Dependencies — # @depends createPost ensures a request runs after its dependency.