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 |
| Column | Type | Required | Description |
|---|---|---|---|
topicAlias | string | โ | Alias of a declared output topic |
expectedRecordsCount | integer | โ | Exact number of records to collect before asserting |
files | string | โ | Comma-separated list of expected file paths (relative to assets dir), one per record |
consumerReadTimeout | integer | โ | Max seconds to wait for all records |
consumerDeltaTime | integer | โ | 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 |
| Column | Type | Required | Description |
|---|---|---|---|
topicAlias | string | โ | Alias of a declared output topic |
expectedRecordsCount | integer | โ | Exact number of records to collect |
files | string | โ | Comma-separated list of expected JSON file paths |
excludedKeys | string | โ | Comma-separated Avro field names to exclude from all records |
consumerReadTimeout | integer | โ | Max seconds to wait for all records |
consumerDeltaTime | integer | โ | How far back (seconds) to seek |
Timeout behaviourโ
- If the consumer collects fewer than
expectedRecordsCountrecords before the timeout, the step fails with:Timed out after Nms waiting for 4 record(s), only 2 collected. - Increase
consumerReadTimeoutif 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.