Fact Skill Tutorial

Build an Alexa Skill in 6 Steps

Step 4: Testing Your Alexa Skill

So far, we have created a Voice User Interface and a Lambda function, and connected the two together. Your skill is now ready to test.

  1. Go back to the Amazon Developer Portal and select your skill from the list. You may still have a browser tab open if you started at the beginning of this tutorial.

  2. Open the "Test" tab on the left side.

  3. Understand the voice simulator. While it's not specific to your skill, the Voice Simulator is a valuable testing tool for every skill. Type a word into the box, and click the "Listen" button to hear how Alexa will pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Language (SSML) to modify how Alexa will interpret text to speech. Try these examples:

    <say-as interpret-as="number">12345</say-as>
    <say-as interpret-as="ordinal">12345</say-as>
    <say-as interpret-as="digits">12345</say-as>

    Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect.

  4. Test your skill with the Service Simulator. To validate that your skill is working as expected, use the Service Simulator. In the Enter Utterance text box, type "give me a fact"

    Service Simulator Tips

    • After you click the "Ask [Your Skill Name]" button, you should see the Lambda Request and Lambda Response boxes get populated with JSON data like in the screenshot above.
    • Click the Listen button in the bottom right corner to hear Alexa read the response.

    • If you receive a response that reads: "The remote endpoint could not be called, or the response it returned was invalid," this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill.

  5. Configure a test event in AWS Lambda. Now that you are familiar with the request and response boxes in the Service Simulator, it's important for you to know that you can use your requests to directly test your Lambda function every time you update it. To do this:

    1. Create & copy a new response with the Service Simulator, or grab the sample text from the box below:

      "session": {
          "sessionId": "SessionId.ce5b9874-0f86-49d0-8fe2-85f5a2008386",
          "application": {
          "applicationId": "amzn1.ask.skill.ac4240ad-4b18-484a-ab67-d740ed1320ac"
          "attributes": {},
          "user": {
          "new": true
      "request": {
          "type": "IntentRequest",
          "requestId": "EdwRequestId.1181fc5e-453e-4bb4-8ec5-ba48bcaf88ec",
          "locale": "en-US",
          "timestamp": "2017-05-03T15:09:42Z",
          "intent": {
          "name": "GetNewFactIntent",
          "slots": {}
      "version": "1.0"
    2. Open your Lambda function in AWS, open the Actions menu, and select "Configure test event."

    3. Choose "Alexa Start Session" from the Sample Event Template dropdown list. You can choose any item in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. This will also be the sample request that fires every time you update and "Save and Test" your Lambda code.

    4. Delete the contents of the box, and paste your request into the box.

    5. Click the "Save and test" button. This will save your test event, and run it against your Lambda function.

      This gives you visibility into four things:

      • Your response, listed in the "Execution Result."

      • A Summary of the statistics for your request. This includes things like duration, resources, and memory used.

      • Log output. By effectively using console.log() statements in your Lambda code, you can track what is happening inside your function, and help to figure out what is happening when something goes wrong. You will find the log to be incredibly valuable as you move into more advanced skills.

      • A link to your CloudWatch logs for this function. This will show you all of the responses and log statements from every user interaction. This is very useful, especially when you are testing your skill from a device with your voice. (It is the "Click here" link in the Log Output description.)

  6. Other testing methods to consider:

  7. If your sample skill is working properly, you can now customize your skill.

When you’re ready, move on to customizing the skill to make it your own.