1
Create a test file
Create a file called This file defines three requests:
api.http:api.http
- getPost — fetches a post, checks its fields, and captures the author’s ID
- createPost — creates a new post and checks the
201response - getAuthor — runs after
getPostand uses the capturedauthorIdto fetch the author
2
Run the tests
3
See results
On success, you see a summary of passing tests:If an assertion fails, hitspec shows exactly what went wrong:The output tells you which assertion failed, on which line, what value was expected, and what was actually returned.
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 (here, authorId) for use in later requests, referenced as {{getPost.authorId}}.
Dependencies — # @depends getPost ensures getAuthor runs after getPost, so the captured authorId is available.
Try it in studio
Prefer an interactive workflow? Open the same file in the terminal UI:Next Steps
Installation
Install hitspec via Homebrew, Go, or binary download.
Studio (Terminal UI)
Edit, run, and inspect requests interactively in the terminal.
Editor Setup
Get syntax highlighting and completions in your editor.
Core Concepts
Learn the file format, variables, assertions, and captures.