5.3 KiB
Executable File
Build An Alexa Skill with In-Skill Purchases - Premium Hello World
Testing Your Alexa Skill
So far, we have created a Voice User Interface, created the in-skill products and deployed code to a backend service linked to the skill. Your skill is now ready to test.
-
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.
-
Access the Alexa Simulator, by selecting the Test link from the top navigation menu.
-
Enable Testing by selecting Development from the drop down found directly below the top navigation menu. Once enabled, the label should read Skill testing is enabled in:
Development. -
To validate that your skill is working as expected, invoke your skill from the Alexa Simulator. You can either type or click and hold the mic from the input box to use your voice.
- Type "Open" followed by the invocation name you gave your skill in Step 1. For example, "Open Premium Hello World".
- Use your voice by clicking and holding the mic on the side panel and saying "Open" followed by the invocation name you gave your skill.
- If you've forgotten the invocation name for your skill, revisit the Build panel on the top navigation menu and select Invocation from the sidebar to review it.
-
Test phrases like: - Alexa, open premium hello world - give me a premium greeting - what can I buy - buy premium greeting - what have I bought > Note: if you have enabled a voice code to prevent accidental purchases via voice, you will be required to provide it before you can make an in-skill purchase. If you type that code, be sure to spell the numbers out, e.g. "one two three four" instead of "1234", otherwise the simulator will not recognize your code.
-
Ensure your skill works the way that you designed it to. - After you interact with the Alexa Simulator, you should see the Skill I/O JSON Input and JSON Output boxes get populated with JSON data. You can also view the Device Log to trace your steps. - If it's not working as expected, you can dig into the JSON to see exactly what Alexa is sending and receiving from the endpoint. If something is broken, AWS Lambda offers an additional testing tool to help you troubleshoot your skill.
Note: The developer account associated with the skill is never charged for in-skill products. For more details about testing skills with in-skill products, please refer to the In-Skill Purchase Testing Guide
If you need to reset a test purchase, you can return to the In-Skill Products page in the Alexa Developer Console. (That's on the Build tab, and click on In-Skill Products in the left nav. If you don't see it there, click on the In-Skill Products item in the Skill Builder Checklist.) Then click on the Reset test purchases link to reset your purchases for that product. This will work regardless of how you setup the in-skill product (console or CLI).
Pro Tip: type or say
exitin the simulator to reset the session before each test pass. The simulator holds a session open longer than on a device to assist in your testing and it's easy to forget a session is still open.
Other testing methods to consider:**
* Testing on your Alexa enabled devices and applications - any devices registered using the same account as your Alexa developer account will have your skill enabled on them when testing is enabled in development mode. You should always test your skill on an actual device rather than relying solely on the simulator. Keep in mind that in-skill products may not be purchased on all devices, but already purchased products will be available for use on all devices.
* [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go.
* [Unit Testing with Alexa](https://alexa.design/postman-guide) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway).
Note: While in-skill products are only currently available in the English (US) locale, any developer account (regardless of home locale), can be used to create skills with in-skill products. When testing, you must use an account which defaults to the amazon.com marketplace. (You may recall see that marketplace mentioned on the in-skill products' pricing page.) If your developer account does not default to that marketplace, or your billing address is outside the United States, then you will need to create a new account for testing purposes. Create this account using https://www.amazon.com and set an address for somewhere in the United States.
If your sample skill is working properly, you can now customize your skill.
