Skip to main content

Watcher : And record should (not) appear in topic

The watcher steps don't compare record content, they simply verify that at least one record (optionally matching a key) does or does not appear on a topic within the read timeout window.


Record should appear, positive assertionโ€‹

And record should appear in topic
| topicAlias | topicType | consumerReadTimeout | consumerDeltaTime |
| orders-out | raw | 15 | 60 |

Fails if no record appears within consumerReadTimeout seconds.


Record should not appear, negative assertionโ€‹

And record should not appear in topic
| topicAlias | topicType | consumerReadTimeout | consumerDeltaTime |
| orders-out | raw | 10 | 30 |

Passes only if no record appears within consumerReadTimeout seconds. Use this to assert that a message is filtered out or not produced by your pipeline.


Column referenceโ€‹

ColumnTypeRequiredDescription
topicAliasstringโœ…Alias of a declared output topic
topicTypestringโœ…raw or avro โ€” determines deserialiser
consumerReadTimeoutintegerโŒMax seconds to wait (or confirm absence)
consumerDeltaTimeintegerโŒHow far back (seconds) to seek
Choosing the right timeout for negative assertions

For should not appear, set consumerReadTimeout to a value that is long enough to be confident nothing will arrive, but short enough to not slow your suite down unnecessarily. 5โ€“10 seconds is usually a good starting point.


Example : filtering scenarioโ€‹

Scenario: Invalid orders are filtered out
When record from file is sent
| topicName | file | recordKey |
| orders-in | order-invalid.json | order-invalid |
And record should not appear in topic
| topicAlias | topicType | consumerReadTimeout |
| orders-out | raw | 10 |