@@ -14,14 +14,14 @@ export const TestActionTypeSchema = z.enum([
1414 'api_call' ,
1515 'run_script' ,
1616 'wait' // Testing async processes
17- ] ) ;
17+ ] ) . describe ( 'Type of test action to perform' ) ;
1818
1919export const TestActionSchema = z . object ( {
20- type : TestActionTypeSchema ,
20+ type : TestActionTypeSchema . describe ( 'The action type to execute' ) ,
2121 target : z . string ( ) . describe ( 'Target Object, API Endpoint, or Function Name' ) ,
2222 payload : z . record ( z . string ( ) , z . unknown ( ) ) . optional ( ) . describe ( 'Data to send or use' ) ,
23- user : z . string ( ) . optional ( ) . describe ( 'Run as specific user/role' ) // Impersonation
24- } ) ;
23+ user : z . string ( ) . optional ( ) . describe ( 'Run as specific user/role for impersonation testing' )
24+ } ) . describe ( 'A single test action to execute against the system' ) ;
2525
2626// Assertion Types
2727export const TestAssertionTypeSchema = z . enum ( [
@@ -36,46 +36,46 @@ export const TestAssertionTypeSchema = z.enum([
3636 'lt' ,
3737 'lte' ,
3838 'error' // Expecting an error
39- ] ) ;
39+ ] ) . describe ( 'Comparison operator for test assertions' ) ;
4040
4141export const TestAssertionSchema = z . object ( {
4242 field : z . string ( ) . describe ( 'Field path in the result to check (e.g. "body.data.0.status")' ) ,
43- operator : TestAssertionTypeSchema ,
44- expectedValue : z . unknown ( )
45- } ) ;
43+ operator : TestAssertionTypeSchema . describe ( 'Comparison operator to use' ) ,
44+ expectedValue : z . unknown ( ) . describe ( 'Expected value to compare against' )
45+ } ) . describe ( 'A test assertion that validates the result of a test action' ) ;
4646
4747// --- Test Structure ---
4848
4949export const TestStepSchema = z . object ( {
50- name : z . string ( ) ,
51- description : z . string ( ) . optional ( ) ,
52- action : TestActionSchema ,
53- assertions : z . array ( TestAssertionSchema ) . optional ( ) ,
50+ name : z . string ( ) . describe ( 'Step name for identification in test reports' ) ,
51+ description : z . string ( ) . optional ( ) . describe ( 'Human-readable description of what this step tests' ) ,
52+ action : TestActionSchema . describe ( 'The action to execute in this step' ) ,
53+ assertions : z . array ( TestAssertionSchema ) . optional ( ) . describe ( 'Assertions to validate after the action completes' ) ,
5454 // Capture outputs to variables for subsequent steps
5555 capture : z . record ( z . string ( ) , z . string ( ) ) . optional ( ) . describe ( 'Map result fields to context variables: { "newId": "body._id" }' )
56- } ) ;
56+ } ) . describe ( 'A single step in a test scenario, consisting of an action and optional assertions' ) ;
5757
5858export const TestScenarioSchema = z . object ( {
59- id : z . string ( ) ,
60- name : z . string ( ) ,
61- description : z . string ( ) . optional ( ) ,
62- tags : z . array ( z . string ( ) ) . optional ( ) , // e.g. "critical", "regression", "crm"
59+ id : z . string ( ) . describe ( 'Unique scenario identifier' ) ,
60+ name : z . string ( ) . describe ( 'Scenario name for test reports' ) ,
61+ description : z . string ( ) . optional ( ) . describe ( 'Detailed description of the test scenario' ) ,
62+ tags : z . array ( z . string ( ) ) . optional ( ) . describe ( 'Tags for filtering and categorization ( e.g. "critical", "regression", "crm")' ) ,
6363
64- setup : z . array ( TestStepSchema ) . optional ( ) . describe ( 'Steps to run before main test' ) ,
65- steps : z . array ( TestStepSchema ) . describe ( 'Main test sequence' ) ,
66- teardown : z . array ( TestStepSchema ) . optional ( ) . describe ( 'Steps to cleanup' ) ,
64+ setup : z . array ( TestStepSchema ) . optional ( ) . describe ( 'Steps to run before main test (preconditions) ' ) ,
65+ steps : z . array ( TestStepSchema ) . describe ( 'Main test sequence to execute ' ) ,
66+ teardown : z . array ( TestStepSchema ) . optional ( ) . describe ( 'Steps to cleanup after test execution ' ) ,
6767
6868 // Environment requirements
6969 requires : z . object ( {
70- params : z . array ( z . string ( ) ) . optional ( ) , // Required env vars or params
71- plugins : z . array ( z . string ( ) ) . optional ( )
72- } ) . optional ( )
73- } ) ;
70+ params : z . array ( z . string ( ) ) . optional ( ) . describe ( ' Required environment variables or parameters' ) ,
71+ plugins : z . array ( z . string ( ) ) . optional ( ) . describe ( 'Required plugins that must be loaded' )
72+ } ) . optional ( ) . describe ( 'Environment requirements for this scenario' )
73+ } ) . describe ( 'A complete test scenario with setup, execution steps, and teardown' ) ;
7474
7575export const TestSuiteSchema = z . object ( {
76- name : z . string ( ) ,
77- scenarios : z . array ( TestScenarioSchema )
78- } ) ;
76+ name : z . string ( ) . describe ( 'Test suite name' ) ,
77+ scenarios : z . array ( TestScenarioSchema ) . describe ( 'List of test scenarios in this suite' )
78+ } ) . describe ( 'A collection of test scenarios grouped into a test suite' ) ;
7979
8080export type TestSuite = z . infer < typeof TestSuiteSchema > ;
8181export type TestScenario = z . infer < typeof TestScenarioSchema > ;
0 commit comments