/alexa-skill-test

Test Alexa skills through a local Express server.

Primary LanguageJavaScript

Alexa Skill Test

Alexa Skill Test provides a live server for local testing of Alexa Skills written in Node.js. Right now, testing skills usually involves going through the Amazon Alexa Developer Portal. This project makes testing much easier.

Requirements

  • Node/npm
  • An Amazon Alexa Skill written in Node.js

Install

It's recommended to install Alexa Skill Test as a global npm package:

npm install -g alexa-skill-test

After install, the alexa-skill-test command will be available to you.

Command

Alexa Skill Test works off one command:

alexa-skill-test [--path] [--interaction-model]

--path let's you optionally specify a relative path to your skill. --interaction-model let's you optionally specify a relative path to your interaction model.

Usage

Within your terminal, change directory to your valid Amazon skill. Your skill will need a package.json and a main script file. Run the following command:

alexa-skill-test

This starts up a local testing server using your Alexa skill. If you specify a relative path to an interaction model using --interaction-model, the app will prefill your skill intents for you.

In your browser, navigate to http://localhost:3000. You should see a simple UI for sending test requests to your skill.

Note:

In the skill(s) you're testing, you should set your appId like so:

if ('undefined' === typeof process.env.DEBUG) {
  alexa.appId = '...';
}

Setting an appId while debugging will cause Lambda to throw an error since there will be a mismatch. Alexa Skill Test will automatically set the DEBUG environmental variable.

License

MIT