{{announcement.body}}
{{announcement.title}}

DevOps Your Skill: Validation Tests

DZone 's Guide to

DevOps Your Skill: Validation Tests

In this article, we discuss how to make validation tests and run it in Alexa in your pipeline and its importance in the day-to-day Alexa Skills development.

· DevOps Zone ·
Free Resource

There is another important step in an Alexa Skill development process. It is not related to the code or if the skill and its components are running properly. This step is the validation of our Alexa Skill before submitting it to certification. It means that the metadata of our Skill (logos, description, examples, etc) are properly filled. We can check it in our pipeline thanks to the ASK CLI and the use of the Alexa Skill Management API.

One of the most important steps in our pipeline is to validate our Alexa Skill. These tests are automated in the continuous integration system (CircleCI) and are executed in each new version of the software.

Prerequisites

Here you have the technologies used in this project

  1. ASK CLI - Install and configure ASK CLI.
  2. CircleCI Account - Sign up here.
  3. Node.js v10.x.
  4. Visual Studio Code.

ASK CLI (Alexa Skill Kit CLI)

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 validate our Alexa Skill. Let's start!

Installation

The ASK CLI is included in the Docker image we are using, so it is not necessary to install anything else.

Writing the Test

In this step of the pipeline, we are going to develop some tests written in bash using the ASK CLI.

The Alexa Official documentation says that the Alexa Skill Validation API is an asynchronous API that can be used by skill developers to validate their skills before submitting them for certification or at any time during development as regression testing. A successful response may contain both successful and failed validation results. The Alexa Skill Validation API will also determine if a skill update qualifies for an instant update to a live skill.

This is an asynchronous process. so we have to start the validation with one command and then get the result with another when the validation is finished:

  1. For ask cli v1:
Shell
  1. For ask cli v2:
Shell


Those commands are integrated into the bash script file test/validation-test/skill_validation_checker.sh.

Here you can find the full bash script:

Shell


The test automatically detects if the Alexa Skill is ready to submit to certification.

This script has two parameters:

  1. The id of the skill
  2. The version of the ASK CLI you are running (v1 or v2).

Reports

There are not reports defined in this job.

Integration

It is not necessary to integrate it in package.json file.

Pipeline Job

Everything is ready to run and validate our Alexa Skill, so let's add it to our pipeline!

This job will execute the following tasks:

  1. Restore the code that we have downloaded in the previous step in /home/node/project folder
  2. Run the skill_validation_checker script.
  3. Persist again the code that we will reuse in the next job
YAML


Note: To perform these tests in CircleCI, you have to set the environment variable SKILL_ID with the id of your Alexa Skill.

Resources

Conclusion

We have to keep in mind this kind of test. Despite we are not checking code here, this test will validate that our Alexa Skill will look really cool in the Skill Store so do not forget to run it. This is why these tests are very relevant in our pipeline. Thanks to the ASK CLI we can perform these complex tests.

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.

Happy coding!

Topics:
alexa, alexa app development, alexa skill, alexa skill development, alexa skills, alexa skills developer, alexa skills development, devops, test, validation testing

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}