Test Runner
The test runner allows you to automate API testing with assertions, variable extraction, and detailed reporting.
Overview
Opening the Test Runner
- Right-click on a collection in the sidebar
- Select Run Tests
- A new tab opens with the test runner
Test Configuration
Request Order
Requests run in the order they appear in the collection. Drag to reorder.
Run Options
| Option | Description |
|---|---|
| Stop on Failure | Stop execution when a test fails |
| Delay Between Requests | Wait time between requests (ms) |
Assertions
Each request can have multiple assertions to verify the response.
Assertion Types
| Type | Description | Example |
|---|---|---|
| Status | Check status code | status == 200 |
| Status Range | Check status in range | status in 200-299 |
| JSONPath | Check JSON value | $.data.id == "123" |
| Contains | Check body contains text | body contains "success" |
| Response Time | Check response time | time < 500ms |
| Header | Check header value | header Content-Type == application/json |
Adding Assertions
- Click on a request in the test runner
- Go to Assertions section
- Click Add Assertion
- Configure:
- Type
- Expected value
- Operator (for JSONPath)
JSONPath Examples
| JSONPath | Description |
|---|---|
$.data.id | Get id from data object |
$.users[0].name | First user's name |
$.items[*].price | All prices |
$.meta.total | Total from meta |
Operators
| Operator | Description |
|---|---|
equals | Exact match |
not_equals | Not equal |
contains | Contains substring |
exists | Value exists |
not_exists | Value doesn't exist |
Variable Extraction
Extract values from responses to use in subsequent requests.
Adding Extractions
- Go to Extract Variables section
- Click Add Extraction
- Configure:
- Variable Name: Name to store as
- JSONPath: Path to extract
Example Flow
Request 1: Create User
- Extract:
USER_IDfrom$.id
Request 2: Get User
- URL:
{{API_URL}}/users/{{USER_ID}}
Running Tests
Start Test Run
- Click Run All to execute all requests
- Or click Run on individual requests
Progress
During execution:
- Current request is highlighted
- Progress bar shows completion
- Results update in real-time
Stopping
Click Stop to halt execution at any time.
Test Results
Summary
| Metric | Description |
|---|---|
| Total | Number of requests |
| Passed | Successful tests |
| Failed | Failed assertions |
| Errors | Request errors |
| Time | Total execution time |
Per-Request Results
Each request shows:
- ✓ Passed / ✗ Failed status
- Response status code
- Response time
- Assertion results
- Extracted variables
Assertion Details
For each assertion:
- Expected value
- Actual value
- Pass/Fail status
Test History
Previous test runs are saved:
- Go to History tab in test runner
- View past runs with timestamps
- Click to see detailed results
Example Test Suite
User API Tests
Request 1: Create User
POST {{API_URL}}/users
Body: {"name": "Test User", "email": "test@example.com"}
Assertions:
- Status == 201
- $.id exists
- $.name == "Test User"
Extract:
- USER_ID from $.id
Request 2: Get User
GET {{API_URL}}/users/{{USER_ID}}
Assertions:
- Status == 200
- $.id == "{{USER_ID}}"
- Response time < 500ms
Request 3: Update User
PUT {{API_URL}}/users/{{USER_ID}}
Body: {"name": "Updated User"}
Assertions:
- Status == 200
- $.name == "Updated User"
Request 4: Delete User
DELETE {{API_URL}}/users/{{USER_ID}}
Assertions:
- Status in 200-204
Best Practices
Design tests that can run independently when possible.
Include cleanup requests (delete created resources) at the end.
Test business logic, not just status codes:
- Verify response structure
- Check calculated values
- Validate relationships
Use extraction to chain requests and avoid hardcoded IDs.