I'm developing an Alexa skill in node and I'd like to know how I can unit test my code. I'm using the alexa sdk that Amazon released.
I've found many libraries to accomplish this, but they seem to be developed before the alexa sdk was available.
Thanks in advance.
We built our Alexa emulator specifically for the purpose of allowing easy unit-testing and functional-testing of Alexa skills:
http://docs.bespoken.tools/en/latest/tutorials/tutorial_bst_emulator_nodejs/
With it, you can make calls like this:
alexa.launched(function (error, response) {
alexa.spoken('About the podcast', function (error, response) {
assert.equal(response.response.outputSpeech.ssml, '<speak> Some SSML </speak>');
done();
});
});
This test code imitates a user launching the skill and saying "About the Podcast". These interactions are automatically translated to the correct Alexa JSON requests, which in turn are then sent to your skill code.
You can also create more sophisticated unit-tests that rely on mimicking the internal state of Alexa device across interactions. These are described in the tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With