The DSL (Domain-specific language) is a specialized language enabling rapid test declaration and version control of your Test Scenarios.
When you use the Testing UI, it's possible to toggle between the visual and code-wise representation of a test.
Additionally, it's possible to export the DSL behind a test scenario, and version control it in a system like Github. You can also import the DSL from a file, and create a test scenario from it.
Below shows an example of a simple Test Scenario that:
- Produces a
Hello Worldmessage to a Kafka topic
- Consumes the message
- Checks the data of the consumed record
name: My first scenario
value: Hello World
- app.name: Conduktor Testing
value: Conduktor Testing
value: Hello World
- task: Produce
- task: Consume
Toggling the DSL view
When using Conduktor Testing, you can switch between the visual representation and the DSL in multiple ways.
You can switch at a:
- Task level
- Scenario level
Task Level DSL
When in edit mode for a Task, use the DSL View button to switch to the code-wise representation of your task.
After switching the view, you will see the DSL representation of the currently selected task. If preferable, you can edit the task via the DSL editor.
Scenario Level DSL
To see your entire test scenario represented via the DSL, access the DSL tab from the editor view.
You can edit the scenario DSL in this view, and also export it if you wish to store it elsewhere.
Restore a DSL version
If you have made changes to your test scenario, but want to rollback to a previous version, it's possible to do this from the DSL tab.
When in the DSL view for a test scenario, select the previous version from the version history.
Note you will see a diff comparing the current version against your previously selected version.
To rollback to a previous version, select Restore version from the diff comparison view.
Import DSL as a new test scenario
If you prefer to declare tests utilising the DSL, you may want to import a scenario so that:
- It's visually represented inside the UI
- You can export the CI configuration for automation
From within a Test Suite, select the Import from DSL option.
In the DSL import modal, either paste your code into the editor, or upload from a file.