Testing REST API Endpoints
Learn how to create and run tests for your REST API endpoints using A²D’s testing framework.
Overview
REST APIs in A²D can be tested through:
- Playground — Interactive testing from the REST API detail page.
- A2TF Test Cases — Automated tests with expected conditions.
- Test Lab Suites — Group tests and run them in suites.
- Exploratory Testing — Invite external users to test endpoints.
Quick Start: Playground
- Open your REST API from the sidebar.
- Click the Playground tab.
- Click Refresh to load endpoints from the API definition.
- Expand an endpoint card, fill in parameters, and click Send.
- View the response status, headers, and body.
Creating Automated Tests
Step 1: Open Test Cases
Navigate to your REST API detail page and click the Test Cases tab.
Step 2: Create a Test Case
Click ”+ New Test” and configure:
- Name — A descriptive name (e.g. “Get product by ID returns correct product”).
- Scopes — Select which endpoints to test.
- Input — Configure path parameters, query parameters, custom headers, and request body.
Step 3: Import from Mock Scenarios
Instead of creating tests from scratch, you can auto-generate them from mock scenarios:
- Click “Import from Scenarios”.
- Select which scenarios to import.
- Tests are created with inputs and expected conditions pre-filled.
Step 4: Define Expected Conditions
For each endpoint scope, configure validation rules:
Status Code: Set the expected HTTP status code (e.g. 200, 201, 404).
Field Conditions: Add conditions to validate the response body. Since REST API responses are auto-parsed as JSON, use direct field paths:
| Path | Description |
|---|---|
productId | Top-level field |
data.items[0].name | Nested field with array index |
error.message | Nested error field |
items.0.id | Alternative array notation (.0 instead of [0]) |
Available Operations
| Operation | Description | Example |
|---|---|---|
eq | Equals expected value | productId (eq) "MULETEST0" |
neq | Not equal | status (neq) "error" |
exists | Field exists and is not null | productId (exists) |
contains | String contains substring | message (contains) "success" |
isNumeric | Value is a number | quantity (isNumeric) |
isText | Value is a non-empty string | name (isText) |
isArray | Value is an array | items (isArray) |
isObject | Value is an object | metadata (isObject) |
matchesRegex | Matches regex pattern | email (matchesRegex) "^[^@]+@[^@]+$" |
Example: Validate Product Response
For a REST API endpoint POST /mmbe that returns:
{
"productId": "MULETEST0",
"availibleQuantity": 1650400
}Configure these conditions:
- Status code: expected
200 - Path:
productId, Op:exists - Path:
productId, Op:eq, Value:"MULETEST0" - Path:
availibleQuantity, Op:isNumeric
Running Tests
From the REST API Page
On the Test Cases tab, click Run on individual tests.
From Test Lab
- Go to Test Lab → Execution.
- Select a suite that includes REST API tests.
- Choose the environment.
- Click Run.
Viewing Results
Test results show:
- Endpoint label — Displays as
POST /mmbe(method + path) instead of a generic label. - Input — The HTTP request sent (URL, method, body).
- Output — The response received (body, status code).
- Validation — Each condition with its expected value, actual value, and pass/fail indicator.
If a condition fails, you can see exactly what was expected vs what was received:
productId (eq) expected: "MULETEST0", actual: "OTHER_VALUE" ✗Exploratory Testing
Include REST APIs in exploratory testing sessions:
- Go to Test Lab → Exploratory.
- Create or open a session.
- Click the REST APIs tab.
- Add REST APIs with their environments.
- Invite testers — they’ll see endpoints as interactive cards.
- Review feedback in the Feedback tab.
Next Steps
- REST APIs — Feature overview.
- A2TF Testing Framework — Test design and suites.
- Exploratory Testing — Hands-on testing.
- Protocol Tester — Interactive in-app testing.
Test your REST API endpoints with automated validations and hands-on exploratory testing.