DevOps Your Skill: Integration Tests
DevOps Your Skill: Integration Tests
In this article, we discuss how to make integration tests in Alexa Skills in your pipeline and its importance in the day-to-day Alexa Skills development.
Join the DZone community and get the full member experience.Join For Free
Integration tests ensure that the components of an application is running properly at a level that includes the auxiliary infrastructure of the application, such as the voice user interface, the backend, and the integration with external systems.
Integration tests evaluate the components of an application at a higher level than unit tests. Unit tests are used to test isolated software components, such as individual class methods. Integration tests check that two or more components of an application work together, and they generate an expected result, possibly including all the components necessary to fully process a request.
These tests are automated in the continuous integration system (CircleCI) and are executed in each new version of the software.
Here you have the technologies used in this project
- ASK CLI - Install and configure ASK CLI.
- CircleCI Account - Sign up here.
- Node.js v10.x.
- Visual Studio Code.
The Alexa Skills Kit Command Line Interface (ASK CLI) is a tool for you to manage your Alexa skills and related resources, such as AWS Lambda functions. With ASK CLI, you have access to the Skill Management API, which allows you to manage Alexa skills programmatically from the command line. We will use this powerful tool to test our Voice User Interface. Let's start!
The ASK CLI and the bash tool
expect are included in the Docker image we are using, so it is not necessary to install anything else.
In this step of the pipeline we are going to develop some tests written in bash using the ASK CLI.
Once we have tested our Voice User Interface and we check that everything is correct. It is time to test all software components related in an Alexa Skill request.
This integration tests can be performed with the ASK CLI. we will use the following ASK CLI command:
- For ask CLI v1 and v2:
With this command, we will perform a simulation of a dialog with our Alexa Skill using plain text as input. So with that, we can test that all software components are running properly.
Those commands are integrated in the bash script file
Here you can find the full bash script:
There are not reports defined in this job.
It is not necessary to integrate it in
Everything is ready to run our integration tests, let's add it to our pipeline!
This job will execute the following tasks:
- Restore the code that we have downloaded in the previous step in
- Run the
- Persist again the code that we will reuse in the next job
NOTE: To perform these tests in CircleCI you have to set the environment variable
SKILL_ID with the id of your Alexa Skill.
- DevOps Wikipedia - Wikipedia reference
- Official Alexa Skill Management API Documentation - Alexa Skill Management API Documentation
- Official CircleCI Documentation - Official CircleCI Documentation
Check that all components of our application are running properly is one of the most important things in every pipeline. These tests are used to test the application infrastructure and its components. This is why these tests are very relevant in our pipeline. Thanks to the ASK CLI we can perform this complex tests.
You can write integration tests with Bespoken as well. See documentation here. And set type test to
simulation isntead of
That’s all, folks!
You can find the code in my GitHub.
I hope it will be useful! If you have any doubts or questions, do not hesitate to contact me or put a comment below.
Opinions expressed by DZone contributors are their own.