concept simulate in category alexa

appears as: simulate
Voice Applications for Alexa and Google Assistant

This is an excerpt from Manning's book Voice Applications for Alexa and Google Assistant.

The ASK CLI has its own tooling for testing in the simulate command. This command takes a written utterance and sends it to the Alexa platform, and back, ultimately, to the terminal. In doing so it offers up the request, response, and execution metrics. This won’t replace testing through directly invoking the fulfillment or testing on a device, but it adds another tool for ad hoc or automated testing.

Listing 4.10 Using the ASK CLI simulate command to test the LaunchRequest
$ ask simulate \
--locale en-US \
--skill-id amzn1.ask.skill.fcaf69830-3cf2-4980-b1a2-3b9999e8a34c \
--text "launch super sleeper"    #1  

#1   The utterance a user would say to Alexa

This command snakes its way through the entire skill flow, as you can see in figure 4.6, and returns JSON containing both the request sent to the fulfillment and the response the fulfillment created. You already know that a voice application is simply data flowing through services. With that in mind, and considering that the simulate command provides the data coming and going, plus the fact that an AWS Lambda function is really just a function that we can call with arguments, we can use the returned JSON for testing the fulfillment locally.

figure 4.6 The simulate command communicates with Alexa and returns the request and response.

c04_06.eps

Because the simulate command outputs a JSON response, we can send that directly to a file.