Skip to main content

Tags used in tests

A test is a set of test cases. Each test case imitates a dialog between a client and a bot. Test cases are enclosed within the <test></test> root tag.

Test cases are specified within the <test-case></test-case> tags. Special tags are used in test cases. These tags are similar to some of the JAICP DSL tags.

Tags for test cases

TagDescription
<a>Tests:
• The existence of a bot response.
• The response text.
• The state in which the response was generated.
• The state which started script execution.
<context>Sets values for the $client and $session variables in tests.
<dateTime>Overrides date and time for the JS API functions such as currentTime, dateForZone, timeForZone.
<event>Emulates sending an event to a bot.
<mail>Tests usage of the $mail service.
<mockData>Sets up fake responses to HTTP requests made from a bot script (mock objects).
<mockService>Sets up fake responses to third-party service integration method calls.
<newSession>Checks the presence and parameters of the newSession reaction.
<q>Emulates sending a text message to a bot by a user.
<random>Sets the numbers that will be returned by the random function of the JS API.
<rawRequest>Allows sending the $request.rawRequest structure, which a request dump is usually saved into.
<request>Allows sending a complete request object. The tag can be used to pass any request parameters.
<requestData>Allows passing request parameters.
<responseData>Checks all the fields of the $response.data object. Only fields specified inside the tag body are checked.
<state>Forces a transition of a dialog context into the specified state. All actions taken after using the tag will be considered in the context of the specified state.
<timeout>Emulates user inactivity within the period of time previously specified in the script by the timeout reaction.
<timeoutReply>Checks the presence and parameters of the timeout reaction.