Dialog set fields
A file with a dialog set must have the following fields:
Other fields in the file are ignored.
testCase
The name of the test case that contains the step.
A test case can have several steps.
In this case, specify the same value for the steps in the testCase
field.
The test case steps are performed in the same order as in the file. If one of the steps is unsuccessful, the following steps are also considered unsuccessful and are not performed.
Example: a test case with several steps
- Table
- CSV
testCase | comment | request | expectedResponse | expectedState | skip | preActions |
---|---|---|---|---|---|---|
weather | /start | /Start | ||||
weather | well, hello | Hello there! | /Hello | |||
weather | What’s the weather? | /Hello/Weather |
testCase ,comment ,request ,expectedResponse ,expectedState ,skip ,preActions
weather , ,/start , ,/Start , ,
weather , ,"well, hello" ,Hello there! ,/Hello , ,
weather , ,What's the weather? , ,/Hello/Weather , ,
The weather
test case consists of three steps:
- The user says “/start”.
Expected reaction: the bot transitions to the
/Start
state. - The user says “well, hello”.
Expected reaction: the bot transitions to the
/Hello
state and replies “Hello there!”. - The user says “What’s the weather?”.
Expected reaction: the bot transitions to the
/Hello/Weather
state.
If the field is not filled out, a random identifier is used.
comment
Comment for the step. This field is optional.
request
The user request that the bot will react to.
expectedResponse и expectedState
Bot reaction:
expectedResponse
is the expected text of bot’s response.expectedState
is the first state the bot must transition to. Specify the full path. The path must start with/
.
A step must have at least one of these fields filled out.
Only filled fields are checked during the test. If the expected values match the received ones, the step is considered successful.
Several responses in a row
The bot can give several responses in a row:
-
In one state:
state: Hello
a: Hello!
a: How are you? -
When transitioning between states:
state: Hello
a: Hello!
go!: /Question
state: Question
a: How are you?
In these cases, specify responses in the expectedResponse
field and separate them with a space: Hello! How are you?
Random responses
The bot can give a random response:
state: Success
random:
a: Thanks for ordering!
a: Order accepted!
a: Thanks for buying!
To check a random response, provide all possible response variants.
Specify each additional variant on a new line in the expectedResponse
field and leave all other fields empty.
- Table
- CSV
testCase | comment | request | expectedResponse | expectedState | skip | preActions |
---|---|---|---|---|---|---|
success | buy | Thanks for ordering! | ||||
Order accepted! | ||||||
Thanks for buying! |
testCase ,comment ,request ,expectedResponse ,expectedState ,skip ,preActions
success , ,buy ,Thanks for ordering! , , ,
, , ,Order accepted! , , ,
, , ,Thanks for buying! , , ,
The step is considered successful if the response matches one of the three phrases: “Thanks for ordering”, “Order accepted!” or “Thanks for buying!”.
You can also use masks in each response variant.
Masks in responses
A bot response text can be generated dynamically: for example, if the bot adds data received from an external system to the response. The full text of the response is not known in advance, because some parts of the response may change.
In these cases, you can use masks in the expectedResponse
field:
Mask | Description | Examples |
---|---|---|
{NUMBER} | A sequence of digits. |
|
{WORD} | A sequence that can contain letters, digits, and a hyphen (- ). |
|
{LINK} | A URL address with the HTTP or HTTPS protocol. The address can contain Cyrillic characters. | |
{ANYTHING} | A sequence of any characters. It consists of at least one character. |
|
To escape a mask, specify the \
symbol before the mask.
Example: \{LINK}
.
Mask use examples
expectedResponse | Text that matches the expectedResponse |
---|---|
Available days: {WORD}, {WORD} | Available days: Monday, Thursday |
Order number: ${NUMBER}. Follow the link: {LINK} | Order number: 15. Follow the link: https://example.com |
Your secret code: {ANYTHING} | Your secret code: Abc123_!? ,. |
Specify the number in the \{NUMBER} format | Specify the number in the {NUMBER} format |
skip
The field determines whether the step is skipped.
Possible values: TRUE
, FALSE
(default). The value is case-insensitive.
If TRUE
, the step is skipped and not checked.
preActions
The name of the test case whose steps will be performed before the current step.
Steps from preActions
:
- are not checked and do not affect the test result;
- are always performed, even if their
skip
field is set toTRUE
.
Example of preActions usage
- Table
- CSV
testCase | comment | request | expectedResponse | expectedState | skip | preActions |
---|---|---|---|---|---|---|
hello | /start | /Start | ||||
hello | well, hello | Hello there! | /Hello | |||
weather | What’s the weather? | /Hello/Weather | hello | |||
alarm | Set an alarm | /Hello/Alarm | hello |
testCase ,comment ,request ,expectedResponse ,expectedState ,skip ,preActions
hello , ,/start , ,/Start , ,
hello , ,"well, hello" ,Hello there! ,/Hello , ,
weather , ,What's the weather? , ,/Hello/Weather , ,hello
alarm , ,Set an alarm , ,/Hello/Alarm , ,hello
To check the weather or set an alarm, the user must first say “/start” and “well, hello”. If you don’t want to add these steps to the weather
and alarm
test cases, you can specify them in the hello
test case:
- The user says “/start”.
Expected reaction: the bot transitions to the
/Start
state. - The user says “well, hello”.
Expected reaction: the bot transitions to the
/Hello
state and replies “Hello there!”.
You can now perform these steps before the weather
and alarm
test cases using the preActions
field.
The weather
test case:
- The
preActions
steps are performed:- The user says “/start”.
- The user says “well, hello”.
- The user says “What’s the weather?”.
Expected reaction: the bot transitions to the
/Hello/Weather
state.
The alarm
test case:
- The
preActions
steps are performed:- The user says “/start”.
- The user says “well, hello”.
- The user says “Set an alarm”.
Expected reaction: the bot transitions to the
/Hello/Alarm
state.
This field is optional.