Interact with skills intuitively and programmatically.
Virtual Alexa allows for interacting with skills programmatically.
The core Virtual Alexa API provides several routines - the three most essential ones:
* launch: Generates JSON for a launch request * intend: Generates JSON as if the given intent was uttered * utter: Generates JSON as if the user said the given phrase
And also check out our YAML Test Scripts. They allow for:
- End-to-end Testing (using our virtual devices)
- SMAPI Simulation-Based Testing (using the Skill Management API)
- Unit-Testing (using this library)
All via our simple, readable YAML syntax. Read more here.
What's New In The Latest Version (0.7.x)
- Request Builder
- Improved Dialog Manager
- More Internals - We've exposed more of the internal elements of Virtual Alexa, such as the AudioPlayer and DialogManager.
Why Do I Need This?
This library allows for easy testing of skills.
You can use it for:
- Unit-testing - ensuring individual routines work correctly
- Regression testing - ensuring the code as a whole works properly
How Do I Get It?
npm install virtual-alexa --save-dev
How Do I Use It?
Easy! Just add a line of code like so:
const va = ;const alexa = vaVirtualAlexa// Lambda function file and name// Path to interaction model file;alexa;
Our "canonical" full example is the Super Simple Unit Testing project.
Virtual Alexa With Async/Await
Here are some basic tests that uses async/await:
This one is using Mocha (and Babel) - you can see the full example here:
Virtual Alexa With Promises
Here's an example using promises:
You can see the full example this is taken from here:
And read all the docs here:
Using The Request Filter
The filter is a powerful tool for manipulating the request payloads that are made to your Alexa skill.
More info on using it here.
Using the request builder (NEW):
Our request builder allows for fine-tuning requests with ease.
To use it, make a call to Virtual Alexa like so:
// Construct the requestconst request = alexa// Directly set any property on the JSON easily with the new set method;const response = await request;
We also support the AudioPlayer! Read more here.
We also support the Display Interface! Read more here.
We also support the Dialog Interface. Read more here.
Using our implementation, you can simulate different payloads coming from the Dialog Manager with ease.
Mocking External Calls (Dynamo and Address API)
We also support mocking external calls, such as ones made to the Address API and Dynamo. Read more here.
This allows for testing without relying on the actual calls, which are difficult if not impossible to configure for unit tests.
We support the entity resolution request payloads.
Using Virtual Alexa, we will automatically add entity resolution information to your slots, based on the your interaction model. It's like magic :-)
How Do I Talk To You?
We look forward to hearing from you!