To make sure your Alexa Skills and Google Actions are robust, we highly recommend testing. Learn how to implement unit tests for your voice apps built with Jovo.
Unit Testing is a testing method that allows you to make sure individual units of software work as expected. This way you don't have to manually test every potential interaction of your voice app after any change you do to the code, which not only saves a lot of time, but also gives you some well deserved peace of mind.
The Jovo TestSuite allows you to create unit tests for your Alexa Skills and Google Actions that can either test certain individual features, or even full conversational sequences.
Use the Jovo Unit Testing Template to get started with some first tests.
Here's everything you need to know to get started:
Since Jovo v2, every new Jovo project comes with Jest as dev dependency and sample tests.
You can add Jest as dev dependencies like this:
Unit tests are usually located in a
test folder of your Jovo project. Naming conventions are
This is how a sample
sample.test.js file with a single test for both Amazon Alexa and Google Assistant could look like:
After you've defined some first tests, add the following script to your
This way, you can run the tests with
npm test. Don't forget to first start the Jovo webhook:
Tests can be run for each platform:
After initializing the TestSuite, you can add test groups like this:
Each test starts with a conversation:
You can also add certain configurations to the constructor of your
Here is a list of the default configurations of the
You can use the request builder of the
testSuite to build a request. The following request types are supported:
After creating a request with the request builder, you can modify with several helper methods:
You can then used these responses to compare them to expected results (see section Check below):
Delete the database for this user with the following method:
Any specific questions? Just drop them below. Alternatively, you can also fill out this feedback form. Thank you!