Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Bespoken's Virtual Device: YAML Test Scripts Demo

The Virtual Device Test Scripts are meant to make it easy for anyone to write automated tests for Alexa and Google Assistant.

They use a simple YAML syntax for allowing anyone to write complex (but still readable) end-to-end tests.

In this simple example, we are going to test the Alexa version of Guess The Price, one of our voice apps. It is also possible to use one single set of tests to QA an app created for both, Alexa and Google platforms. To know how to do it, read here.

Setup

Install Bespoken Tools

Make sure you have npm installed, get it here.

Install Bespoken CLI to run the scripts. Open a command-line and run this command:

npm install bespoken-tools -g

Install project dependencies

This project utilizes the jest-html-reporter to create an HTML version of the test output.

To enable this, just run:

npm install

Within the project directory.

Get your Virtual Device Token

You need to get a token to run the test scripts. A different token is needed per each locale and platform you want to test. Our example works for the Alexa en-US version of the voice app, thus we need just one token. See here for the instructions to get your token.

Configure your test scripts:

Once you get your token, you need to include it in the testing.json configuration file, so you can run the tests.

The first YAML document of the test script (identified with three dashes, ---) defines the configuration section. In this section, you can indicate which locale and which voice to use.

---
configuration:
  locale: en-US
  voiceId: Joey

Additional parameters

The testing.json contains extra configuration parameters like these:

{
  "type": "e2e",
  "homophones": {
    "lettuce": ["let us"],
    "is": ["as", "does", "it's"],
    "two": ["to", "2"],
    "contestant": ["contested"]
  },
  "trace": false,
  "silent": false
}
  • Homophones: Use this to specify words with a similar sound, for example, if you receive "let us" instead of "lettuce" or "to" instead of "two".
  • Trace and silent: Both parameters allow you to get extra information from the response payload, to enable set trace to true and silent to false.

Running tests

The test script files within the en-US folder work for the Alexa version of the voice app.

To run a test script use the test command from the command line like this:

$ bst test en-US\invokingVoiceApp.e2e.yml

To run the entire set of tests in the en-US folder, run the test command as follow:

$ bst test en-US\

That's it! Now just wait, and your tests will run. The results will be shown in the console, as well as summarized in the HTML report at <PROJECT_DIR>/test-report.html

More Info and Docs

See the full docs for the test scripts here.

Questions/Feedback?

Help is only a few clicks away. Have questions or feedback? Email us at support@bespoken.io.

About

This project aims to serve as an example and provides a template to start creating YAML test scripts for end-to-end testing Alexa skills and Google Actions.

Resources

Releases

No releases published

Packages

No packages published