AutoBE
    Preparing search index...

    Block for grouping statements in specific structural contexts.

    SPECIAL USE ONLY: This type represents a block of statements and should only be used in specific contexts where statement grouping is structurally required:

    Unlike a block statement, this is not a statement itself but a structural container for statements. For normal test function flow, use individual statements directly rather than wrapping them in blocks.

    Updated for API-first workflow: Blocks can now contain IApiOperateStatement for API operations with automatic data capture, predicate expressions for validations, and other statement types as needed within conditional logic or function bodies.

    AI function calling restriction: Do not use for general statement grouping in main function flow. Reserve for structural requirements only (conditional branches, function bodies).

    interface IBlock {
        statements: IStatement[] & MinItems<1>;
        type: "block";
    }
    Index

    Properties

    Properties

    statements: IStatement[] & MinItems<1>

    Nested statements within this block.

    Each statement represents a step within the grouped operation. Can include any valid statement type:

    • IApiOperateStatement for API operations with automatic data capture within conditional logic
    • Predicate expressions for validations within blocks
    • Other statement types as needed for the block's purpose

    Maintains the same ordering significance as the root function's statements array.

    🚨 CRITICAL: DO NOT PUT EXPRESSIONS DIRECTLY IN STATEMENTS ARRAY! 🚨

    This array ONLY accepts IStatement types. If you need to execute an expression (like predicates, function calls, etc.), you MUST wrap it in IExpressionStatement:

    ❌ WRONG - Expression directly in statements array:

    statements: [
    { type: "apiOperateStatement", ... },
    { type: "conditionalPredicate", ... } // ❌ This is IExpression, not IStatement!
    ]

    ✅ CORRECT - Expression wrapped in IExpressionStatement:

    statements: [
    { type: "apiOperateStatement", ... },
    {
    type: "expressionStatement", // ✅ Statement wrapper
    expression: {
    type: "conditionalPredicate", ... // ✅ Expression properly contained
    }
    }
    ]

    Statement Types (can go directly in array):

    • IApiOperateStatement
    • IExpressionStatement
    • IIfStatement
    • IReturnStatement
    • IThrowStatement

    Expression Types (must be wrapped in IExpressionStatement):

    • IEqualPredicate, IConditionalPredicate, etc.
    • ICallExpression
    • All literal types and random generators
    • Any other IExpression type

    Example business context - Block: "Premium Customer Workflow"

    • API operation: Verify premium status (with automatic data capture)
    • API operation: Access exclusive content (with automatic data capture)
    • Predicate: Validate premium features are available (wrapped in expressionStatement)
    • API operation: Log premium usage (with automatic data capture)
    type: "block"

    Type discriminator.