External Test Cases
External Test Cases let developers write complete tests as code while integrating with ReAPI’s visual test flows.
What Are External Test Cases?
External Test Cases are:
- Complete test functions written in your IDE
- Integrated with visual flows - QA can include them in test suites
- Tagged and organized - Filter by smoke, regression, auth, etc.
- Fully typed - TypeScript support with autocomplete
Why Use External Test Cases?
| Challenge | Solution |
|---|---|
| Complex test logic hard to express visually | Write in code with full IDE support |
| Tests need version control and code review | Standard Git workflow |
| Want to unit test your test cases | Run locally before deployment |
| Need existing test patterns/frameworks | Use familiar testing approaches |
| QA can’t orchestrate developer tests | QA selects and runs via visual flows |
The Developer-QA Bridge
Developer QA Team
│ │
▼ │
┌────────────────┐ │
│ Write tests │ │
│ in IDE │ │
│ ───────────── │ │
│ • TypeScript │ │
│ • Unit tests │ │
│ • Code review │ │
└───────┬────────┘ │
│ │
▼ │
┌────────────────┐ │
│ Tag and │ │
│ organize │ │
│ ───────────── │ │
│ smoke, auth, │ │
│ regression... │ │
└───────┬────────┘ │
│ │
▼ ▼
┌─────────────────────────────────────────────┐
│ ReAPI Test Platform │
│ ┌──────────────────────────────────────┐ │
│ │ QA builds visual test flows using: │ │
│ │ • Visual API nodes │ │
│ │ • External test case nodes │ │
│ │ • Tag-based test selectors │ │
│ └──────────────────────────────────────┘ │
└─────────────────────────────────────────────┘Quick Example
import { testCase } from '@reapi/test-sdk'
export const loginTest = testCase(
{
id: 'auth-login',
name: 'User Login',
description: 'Validates user login flow',
tags: ['auth', 'smoke', 'critical'],
priority: 1,
timeout: 15000,
},
async () => {
// Make API request
const response = await fetch(`${$server.baseUrl}/api/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: $vars.testUserEmail,
password: $secrets.testUserPassword,
}),
})
const data = await response.json()
// Record assertions
$addAssertionResult({
passed: response.status === 200,
message: response.status === 200
? 'Login returned 200'
: `Expected 200, got ${response.status}`,
operator: 'statusCode',
leftValue: response.status,
rightValue: 200,
})
$addAssertionResult({
passed: !!data.token,
message: data.token ? 'Token received' : 'No token in response',
operator: 'hasToken',
leftValue: !!data.token,
rightValue: true,
})
// Store for subsequent tests
if (data.token) {
$context.authToken = data.token
}
}
)How QA Uses Your Tests
Once deployed and synced:
- External Test Case Node - Run a specific test
- External Test Case Selector - Run tests by tags
┌─────────────────────────────────────────────┐
│ Visual Test Flow │
├─────────────────────────────────────────────┤
│ │
│ ┌─────────┐ ┌─────────────────────┐ │
│ │ Start │───▶│ External Test Case │ │
│ └─────────┘ │ ─────────────────── │ │
│ │ Test: auth-login │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ External Selector │ │
│ │ ─────────────────── │ │
│ │ Tags: ["payments"] │ │
│ │ Mode: ALL │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ Visual API Node │ │
│ │ ─────────────────── │ │
│ │ POST /api/cleanup │ │
│ └─────────────────────┘ │
│ │
└─────────────────────────────────────────────┘Next Steps
- Writing Test Cases - Detailed patterns
- Runtime Globals - Available APIs
- Execution in Flows - How QA runs your tests