AutoBE
    Preparing search index...

    Array forEach expression for iterating over elements with side effects.

    Executes a function for each array element without returning a new array. Used for performing operations on each element such as validation, logging, or side-effect operations that don't require collecting results.

    E2E testing scenarios:

    • Validating each product in a collection meets business requirements
    • Logging details of each order for debugging test scenarios
    • Performing individual validations on user entities from API responses
    • Executing side-effect operations on captured business data

    Note: Use when you need to process each element but don't need to transform or collect results. For transformations, use IArrayMapExpression.

    AI function calling strategy: Use for validation operations or side effects on each element of captured data collections, especially when the operation doesn't produce a new collection.

    interface IArrayForEachExpression {
        array: IExpression;
        function: IArrowFunction;
        type: "arrayForEachExpression";
    }
    Index

    Properties

    Properties

    Array expression to iterate over.

    Must be an expression that evaluates to an array containing business entities or data that requires individual element processing. Often references collections captured from API operations or constructed arrays for testing.

    Each element in the array will be passed to the function for processing. The array can contain any type of business data appropriate for the intended operation.

    Examples:

    • Array of customers from API response requiring individual validation
    • Collection of orders needing status verification
    • List of products requiring individual business rule checks
    • User entities from previous API calls needing processing

    Business context: Represents collections where each element needs individual attention, such as validation, logging, or side-effect operations that don't transform the data but perform actions based on each element's properties.

    function: IArrowFunction

    Arrow function executed for each array element.

    Called once for each element in the array. Should contain operations that process the individual element, such as validation calls, logging operations, or other side effects relevant to the business scenario.

    The function parameter represents the current array element and can be used to access properties and perform element-specific operations.

    type: "arrayForEachExpression"

    Type discriminator.