ObjectStackObjectStack

Testing

Testing protocol schemas

Source: packages/spec/src/qa/testing.zod.ts

TypeScript Usage

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);

TestAction

A single test action to execute against the system

Properties

PropertyTypeRequiredDescription
typeEnum<'create_record' | 'update_record' | 'delete_record' | 'read_record' | 'query_records' | 'api_call' | 'run_script' | 'wait'>The action type to execute
targetstringTarget Object, API Endpoint, or Function Name
payloadRecord<string, any>optionalData to send or use
userstringoptionalRun as specific user/role for impersonation testing

TestActionType

Type of test action to perform

Allowed Values

  • create_record
  • update_record
  • delete_record
  • read_record
  • query_records
  • api_call
  • run_script
  • wait

TestAssertion

A test assertion that validates the result of a test action

Properties

PropertyTypeRequiredDescription
fieldstringField path in the result to check (e.g. "body.data.0.status")
operatorEnum<'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_null' | 'not_null' | 'gt' | 'gte' | 'lt' | 'lte' | 'error'>Comparison operator to use
expectedValueanyExpected value to compare against

TestAssertionType

Comparison operator for test assertions

Allowed Values

  • equals
  • not_equals
  • contains
  • not_contains
  • is_null
  • not_null
  • gt
  • gte
  • lt
  • lte
  • error


TestScenario

A complete test scenario with setup, execution steps, and teardown

Properties

PropertyTypeRequiredDescription
idstringUnique scenario identifier
namestringScenario name for test reports
descriptionstringoptionalDetailed description of the test scenario
tagsstring[]optionalTags for filtering and categorization (e.g. "critical", "regression", "crm")
setupObject[]optionalSteps to run before main test (preconditions)
stepsObject[]Main test sequence to execute
teardownObject[]optionalSteps to cleanup after test execution
requiresObjectoptionalEnvironment requirements for this scenario

TestStep

A single step in a test scenario, consisting of an action and optional assertions

Properties

PropertyTypeRequiredDescription
namestringStep name for identification in test reports
descriptionstringoptionalHuman-readable description of what this step tests
actionObjectThe action to execute in this step
assertionsObject[]optionalAssertions to validate after the action completes
captureRecord<string, string>optionalMap result fields to context variables: { "newId": "body._id" }

TestSuite

A collection of test scenarios grouped into a test suite

Properties

PropertyTypeRequiredDescription
namestringTest suite name
scenariosObject[]List of test scenarios in this suite

On this page