Check the value inside a JSON message consumed from Kafka
First, add a Producer task to your test scenario.
Navigate to the Data tab and select the Value format = JSON.
Produce a JSON message that looks like the below example:
Click the Scenario Start button, and in parallel, add a Consumer task to your test scenario.
Open the task in edit mode and:
- Navigate to the data tab and set the Value format = JSON
- Navigate to the Checks tab in the slide-out component
With the input type Field selection (JQ) selected:
.record.value.idas the field selection
Plain valueselected as the input field, add
abc-123as the value to compare
Save your consumer task and Run your scenario. Navigate to the Checks tab to observe the result of the test check.
Note you must have the Testing Agent installed to run test scenarios.
In this case our test was successful, as the expression validated true against the record that was consumed.
Continue to read more about Check Operators.