| title | Testing |
|---|---|
| description | Testing protocol schemas |
{/*
import { TestAction, TestActionType, TestAssertion, TestAssertionType, TestContext, TestScenario, TestStep, TestSuite } from '@objectstack/spec/qa';
import type { TestAction, TestActionType, TestAssertion, TestAssertionType, TestContext, TestScenario, TestStep, TestSuite } from '@objectstack/spec/qa';
// Validate data
const result = TestAction.parse(data);A single test action to execute against the system
| Property | Type | Required | Description |
|---|---|---|---|
| type | Enum<'create_record' | 'update_record' | 'delete_record' | 'read_record' | 'query_records' | 'api_call' | 'run_script' | 'wait'> |
✅ | The action type to execute |
| target | string |
✅ | Target Object, API Endpoint, or Function Name |
| payload | Record<string, any> |
optional | Data to send or use |
| user | string |
optional | Run as specific user/role for impersonation testing |
Type of test action to perform
create_recordupdate_recorddelete_recordread_recordquery_recordsapi_callrun_scriptwait
A test assertion that validates the result of a test action
| Property | Type | Required | Description |
|---|---|---|---|
| field | string |
✅ | Field path in the result to check (e.g. "body.data.0.status") |
| operator | Enum<'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_null' | 'not_null' | 'gt' | 'gte' | 'lt' | 'lte' | 'error'> |
✅ | Comparison operator to use |
| expectedValue | any |
✅ | Expected value to compare against |
Comparison operator for test assertions
equalsnot_equalscontainsnot_containsis_nullnot_nullgtgteltlteerror
A complete test scenario with setup, execution steps, and teardown
| Property | Type | Required | Description |
|---|---|---|---|
| id | string |
✅ | Unique scenario identifier |
| name | string |
✅ | Scenario name for test reports |
| description | string |
optional | Detailed description of the test scenario |
| tags | string[] |
optional | Tags for filtering and categorization (e.g. "critical", "regression", "crm") |
| setup | Object[] |
optional | Steps to run before main test (preconditions) |
| steps | Object[] |
✅ | Main test sequence to execute |
| teardown | Object[] |
optional | Steps to cleanup after test execution |
| requires | Object |
optional | Environment requirements for this scenario |
A single step in a test scenario, consisting of an action and optional assertions
| Property | Type | Required | Description |
|---|---|---|---|
| name | string |
✅ | Step name for identification in test reports |
| description | string |
optional | Human-readable description of what this step tests |
| action | Object |
✅ | The action to execute in this step |
| assertions | Object[] |
optional | Assertions to validate after the action completes |
| capture | Record<string, string> |
optional | Map result fields to context variables: { "newId": "body.id" } |
A collection of test scenarios grouped into a test suite
| Property | Type | Required | Description |
|---|---|---|---|
| name | string |
✅ | Test suite name |
| scenarios | Object[] |
✅ | List of test scenarios in this suite |