Test an Aura Bot dialog

Guidelines for the design and execution of unit tests for the validation of an Aura Bot dialog

Introduction

When developing a use case, and once the use case dialog is built, it is required to test the dialog in order to verify its proper performance in terms of the conversational flow between the user and aura-bot . This step is mandatory for the OB developers in order to merge their Pull Requests.

This task comprises three main steps:

  1. Generate the unit tests and place them on the use case library.
  2. Execute the unit tests through the Test Adapter that simulates sending messages from the user to the bot.
  3. Validate the dialog with the unit tests within an iterative process: if results are not satisfactory, the required modifications must be done in the dialog .ts file.

Generate the unit tests files

  • Within the use case library, it is recommended that the unit tests files are placed in the folder src/ folder.

  • They should be named with the same name as the correponding dialog, which must be also included in this folder:
    Dialog: <dialog-name>.ts ➡ Test file: <dialog-name>.spec.ts

  • Moreover, if auxiliary files are required for the tests, they can be optionally placed in a folder named /test.

📌 For a proper understanding of the unit tests for dialogs, it is recommended that developers check the source code of the Aura dialog greetings from the library common and its associated unit tests, as an example. The code of these unit tests can be also used as a template for designing your own tests.

Execute the Aura Bot dialogs unit tests

For the execution of the unit tests, read the guidelines How to debug with mocha and Typescript.