Skip to main content

Automated tests

A script test is a step-by-step description of a user’s interaction with the bot and its expected responses. Tests are written in the XML language.

Structure

A test is a set of test cases, each of which represents a separate dialog. Test cases are enclosed within the <test> tag. Test cases are specified within the <test-case> tags.

note

Each test case describes a new session and a new client, so the $session and $client variables are reset before each test case.

Special tags are used in test cases. These tags are similar to some of the JAICP DSL tags.

Example

<test>
<test-case id="Greeting">
<q>Hi</q>
<a>Hi! I’m Alice, the bot.</a>
</test-case>

<test-case id="Farewell">
<q>Bye</q>
<a>I was glad to help you. Bye!</a>
</test-case>
</test>

Running tests

By default, tests run on each bot deployment if they are located in the test project folder. You can change this behavior in the tests section of the chatbot.yaml file. Also, you can set the mode in which the tests will run when deploying the bot:

ModeDescription
Run tests firstTests are run first, and the bot is deployed only if they pass.
Run tests in the backgroundTests are run but don’t block the deployment. A separate notification is sent when the run is finished.
Do not run testsThe bot is deployed without running any tests. This mode can come in handy when you need to verify some minimal changes in the test widget.
tip
The selected mode is saved and used for subsequent deployments until it is changed.