Draft TypeScript code implementation of the test function.
This field contains a preliminary TypeScript implementation of the test function based on the strategic plan. The draft serves as an intermediate step between planning and AST construction, allowing AI agents to:
The draft should be complete, executable TypeScript code that represents the full test function implementation. This code will then be analyzed and converted into the corresponding AST statements structure.
⚠️ CRITICAL: Avoid TypeScript features that complicate AST conversion! ⚠️
❌ AVOID: Template literals, destructuring, for/while loops, switch statements, try/catch blocks, spread operators, arrow functions without blocks
✅ USE: Simple property access, explicit API operations, array methods (arrayMap, arrayForEach), predicate functions, clear if/else chains
Strategic plan for implementing the test scenario.
This field requires AI agents to think through the test implementation strategy before generating actual statements. It should analyze the given scenario and determine the optimal approach for creating a comprehensive test function.
The plan should address:
This planning step ensures that the generated statements follow a logical progression and create a realistic, comprehensive test scenario that properly validates the business workflow.
Array of statements that comprise the test function body.
Each statement represents a discrete step in the test scenario, typically corresponding to business actions like API calls, validations, or state transitions. The order is significant as it reflects the logical flow of the business process.
These statements should be generated by analyzing and converting the draft TypeScript code into structured AST representations, ensuring that the implementation follows the predetermined approach and creates a complete data flow chain representing the business scenario.
⚠️ CRITICAL: Convert unsupported TypeScript features to AutoBeTest AST equivalents! ⚠️
🚨 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: "equalPredicate", ... } // ❌ This is IExpression, not IStatement!
]
✅ CORRECT - Expression wrapped in IExpressionStatement:
statements: [
{ type: "apiOperateStatement", ... },
{
type: "expressionStatement", // ✅ Statement wrapper
expression: {
type: "equalPredicate", ... // ✅ Expression properly contained
}
}
]
Statement Types (can go directly in array):
IApiOperateStatement
IExpressionStatement
IIfStatement
IReturnStatement
IThrowStatement
Expression Types (must be wrapped in IExpressionStatement):
IEqualPredicate
, IConditionalPredicate
, IErrorPredicate
, etc.ICallExpression
IExpression
typeAI function calling strategy: Build statements by parsing the draft code and converting each logical operation into appropriate AST statement types, maintaining the data dependencies and business logic flow established in the draft. Always verify that you're using statement types, not expression types directly.
Root interface representing a complete E2E test function.
This serves as the top-level container for all statements that comprise a test function. Each statement in the array represents a logical step in the test scenario, enabling systematic construction of complex business workflows through AI function calling.
The generation process follows a three-stage approach: planning, drafting, and AST construction. This ensures that AI agents create well-structured, comprehensive test functions through deliberate design phases.
In the context of E2E testing, this typically maps to complete business scenarios like "customer purchase flow" or "seller product management", where each statement handles one aspect of the workflow.