Testing
warning
This documentation page is still being written.
Defining Tests
Test flows can be defined as follows:
define test flow greeting
user "hi"
bot "How are you?"
If you don't want the tests to be tightly coupled with the copy, you can use the name of the pre-defined bot responses directly in the test:
define test flow greeting
user "hi"
bot express greeting
In this way, if the copy of the bot response changes, the test is still valid.
tip
You can write tests for behaviours dependent on the date and time of the conversation by setting $system_datetime
to a fixed value e.g. "2022-01-28T08:00:00.000000"
.
define test flow opening hours question
$system_datetime = "2022-01-31T08:00:00.000000"
user "when do you close tomorrow?"
bot inform closing time with $date="2022-02-01", $closing_time="7pm"
Running Tests
Currently, you can run a test in the playground by writing run TEST_NAME
in the chat window.
COMING SOON
Running all tests will be available very soon.
Recording Tests
Using the playground, you can record your interactions with the model, as tests. To enable this, type "set live log test" or "set live log to test". You will get a confirmation message that the tests will be recorded automatically in the tests/live.co
file. When you're finished, type "set live log off" or simpy refresh the context.
A good practice is to rename the tests after recording and move them to a separate file.
Private Files
When developing reusable components, we might need additional intents to test the component. You can create private files in a colang model i.e. which are not included in another model that will include it. Currently, to mark a file as private, prefix the name with an underscore i.e. "_".