Create a Test Scenario
In this example, we will demonstrate how to create a Test Scenario that will:
- Produce a
Hello World
message into a Kafka topic - Consume the message from the same topic
- Create a Test Check to validate the consumed data
This tutorial assumes you have setup the Testing Agent already.
Create a Test Suite
From within your Workspace, navigate to the Test Suites tab and select Create New.
Give your test suite a name, for example, 'My First Test Suite'.
Create a Test Scenario
From within your newly created test suite, select Create New to create a Test Scenario.
Give your test scenario a name, for example, 'Hello World'.
Add a Produce task
From within the editor view, click Scenario Start and select Producer from the dropdown menu.
In the General tab, select a configured Cluster, and choose the Topic to produce data into.
Navigate to the Data tab and select the serialization format for your message key/value.
With String selected as the value format, enter the value Hello World
.
Select Save to add your Produce task to the graph.
Add a Consume task
Next, we will add a Consume task that will consume the Hello World
message.
Select the Scenario Start button and select Consumer from the dropdown menu.
Navigate to the Data tab and select the deserialization format for your message key/value.
In this case, select String for both message key and value.
Note we will use the default Lifecycle conditions in this example. These assume that we will only consume 1 record.
Navigate to the Checks tab so we can assert the data that's consumed.
Select the + button to add a new test check:
- Select message Value from the Source dropdown
- In this case, it's not necessary to select a field as our message value is a string. However, the jq field selection can be used to access fields within JSON records.
- Select the Type as string
- Operator as equals
- Plain Value as
Hello World
Select Save to add the Consume task to the editor.
Execute your Test Scenario
Select the Run button to execute your test and observe the result.
Note you must have a connected agent selected via the left navigation menu.
Navigate to the Checks tab to see the result of any Test Checks.