Testing Alexa Telling Alexa to open your skill 500 times isn’t fun, but until recently that was how I went about testing my skills. I’d use the developer console to save my voice, but still copying and pasting the same launch command got old, fast. Then if I wanted to test a specific flow I had to type all of the commands for that 😢 I have come up with a set of tools that make testing very easy. They may not be “the best”, but it’s much better than what I had been doing. Alexa testing… Libraries Used Before I get started with the technical details, I should mention that the testing tools that I use should work for any Alexa skills, as long as they’re written in . For the actual skill development process, I use the . If you haven’t tried it, you really should. does have a testing framework that was recently released, but I haven’t invested too much time in figuring it out yet. nodejs Jovo Framework Jovo For my testing library I’m using . I moved away from using Mocha/Chai since Jest includes everything that you need (except for the Alexa interactions) right out of the box. Jest The rest of this tutorial uses the Jovo hello world template. To use this template see their . To get started quick, use the following commands: tutorial npm i -g jovo-clijovo new --init alexaSkill --build testing-alexa-skills Setup To get started you need to open a terminal to the root folder of your project and install as a development dependency and either as a global dependency or a development dependency. virtual-alexa jest npm i -D virtual-alexa jest After jest and virtual alexa are installed, initialize jest so that it knows that you’re working on a nodejs project by running . jest --init Creating a Unit Test Jest runs unit tests that you put in a special folder named , or anywhere in your project as long as they end with or . I prefer keeping my unit tests in the folder since it simplifies deployment to lambda a little bit. __tests__ .test.js .spec.js __tests__ To create the first unit test, create a folder named and create a new file inside it named . Open the folder in your favorite editor and enter the following code: __tests__ tests.js Now execute from the root directory and you should see the following: jest Virtual Alexa Virtual Alexa is a library provided by specifically for unit testing Alexa skills. To create an instance of Virtual Alexa, you need to provide two arguments: a handler and an interaction model. Bespoken The handler is a reference to the nodejs code that would normally be triggered in a lambda function. In our example the handler is , this means that Virtual Alexa will call the handler export in for every request. index.handler index.js The interaction model is the JSON file that you normally edit in the Amazon Alexa Developer interface. It’s where all of the slots and intents for a skill are defined. When using Jovo, you need to make sure this parameter points to the model in the platforms folder. Also, make sure you run before testing if you’ve modified Jovo’s model. jovo build Hopefully this tutorial has provided you enough information to get started testing your Alexa skills. If you have some suggestions or questions, please feel free to leave a comment.