Custom Inputs
When using the editor view to create test scenarios, you will notice the downwards arrow button next to an input field. This enables you to switch the method for inputting field data.
There are multiple options available:
Input Type | Description |
---|---|
Plain | This is a standard field. The value is not interpreted. |
Field Selection (JSON Query) | Use this to access record data and record metadata when making Test Checks. For the technical capabilities of JQ, refer to this link. |
Template (mustache) | Access different properties such as environment and local variables through a selection modal in the UI. |
JavaScript | Create dynamic values or manipulate your data using JavaScript. |
Plain input selection
Using the plain input selection will not interpret the inputted data.
You might use this input for simple test scenarios, where you want to manually define a literal value.
Field Selection (JSON Query)
Use the Field Selection (JQ) option when creating Test Checks. This enables you to access record data and record metadata so you can test the data.
For example, access the record value for a consumed message, and assert the expected value.
See Accessing Kafka message data for more information.
Below shows a more powerful JQ example. It utilizes a Boolean check to evaluate the length of a value within a defined range.
Template (mustache)
This input method allows you to select from variables (environment or local) using a modal within the UI.
When Template is used, click inside the input to show a '+' button.
This will render a modal that presents any configured variables for selection.
When using JSON format to define data, it's possible to use the mustache selection to populate the key or value for a specific node.
JavaScript input
This input type will enable you to execute a JavaScript snippet. You might use this to create a dynamic value, or to manipulate some data.
For example, you could use a JavaScript snippet to compare a timestamp to the current date/time when a scenario is run.
Below shows another example of utilizing Javascript to evaluate if an expression is true.