Skip to main content

Batch Assertions

Batch steps consume multiple records from an output topic in a single step and match each one against a corresponding expected file. Records and files are matched positionally (record[0] โ†’ file[0], etc.).


Raw batch : Then expected records from filesโ€‹

Then expected records from files
| topicAlias | expectedRecordsCount | files | consumerReadTimeout |
| orders-out | 3 | exp-1.json,exp-2.json,exp-3.json | 60 |
ColumnTypeRequiredDescription
topicAliasstringโœ…Alias of a declared output topic
expectedRecordsCountintegerโœ…Exact number of records to collect before asserting
filesstringโœ…Comma-separated list of expected file paths (relative to assets dir), one per record
consumerReadTimeoutintegerโŒMax seconds to wait for all records
consumerDeltaTimeintegerโŒHow far back (seconds) to seek

Avro batch : Then expected records from files based on schemaโ€‹

Then expected records from files based on schema
| topicAlias | expectedRecordsCount | files | excludedKeys |
| orders-out | 2 | exp-1.json,exp-2.json | ts,eventId |
ColumnTypeRequiredDescription
topicAliasstringโœ…Alias of a declared output topic
expectedRecordsCountintegerโœ…Exact number of records to collect
filesstringโœ…Comma-separated list of expected JSON file paths
excludedKeysstringโŒComma-separated Avro field names to exclude from all records
consumerReadTimeoutintegerโŒMax seconds to wait for all records
consumerDeltaTimeintegerโŒHow far back (seconds) to seek

Timeout behaviourโ€‹

  • If the consumer collects fewer than expectedRecordsCount records before the timeout, the step fails with:

    Timed out after Nms waiting for 4 record(s), only 2 collected.

  • Increase consumerReadTimeout if your pipeline produces output slowly.

Ordering caveatโ€‹

Records are matched positionally in the order they are fetched from Kafka partitions. If your pipeline does not guarantee ordering (e.g. multiple partitions), use individual assertion steps per record with expectedRecordKey filtering instead.


See alsoโ€‹