Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automating test and deployment of Alexa Skills

Automating test and deployment of Alexa Skills

Getting started with Alexa Skills is easy using the Amazon Developer Console. However, skill development should adhere to the same standards that emerged for other fields of software engineering like test-driven development, CI/CD, and automation. In this talk, we will discuss the possibilities to test Alexa Skills automatically and to deploy them to multiple stages while storing all information in a version control system. In the end, you will be able to deploy changes to the skill's voice model or the backend implementation with a simple commit to your code repository and an automated CI/CD pipeline.

Thorsten Hoeger

February 27, 2019
Tweet

More Decks by Thorsten Hoeger

Other Decks in Programming

Transcript

  1. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Automating test and deployment of Alexa Skills Thorsten Höger CEO, Cloud Evangelist Taimos GmbH
  2. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Agenda Development Recap Testing Alexa Skills Deployment of Alexa Skills
  3. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Related sessions Enhance Your Visual Alexa Skill Experience with APL (Today at 5pm) Kay Lerch, AWS CI/CD for Serverless and Containerized Applications Clare Liguori, AWS Talk from re:Invent 2018
  4. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.
  5. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Alexa Developer Console
  6. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Intent Configuration
  7. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Slot Configuration
  8. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Store entry
  9. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Endpoints / Lambda
  10. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.
  11. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Lambda Deployment
  12. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Lambda Deployment
  13. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Lambda Deployment
  14. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Manual Testing
  15. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.
  16. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Testing verifies that the system meets the different requirements including, functional, performance, reliability, security, usability and so on. This verification is done to ensure that we are building the system right.
  17. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T The Testing Pyramid
  18. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T The Testing Pyramid End2End
  19. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T The Testing Pyramid Unit / Component
  20. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Tooling for Typescript
  21. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Alexa Skill Test Framework
  22. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Skill Code (part) class LaunchRequestHandler extends NamedIntentRequestHandler { constructor() { super('LaunchRequest'); } public async handle(handlerInput : HandlerInput) : Promise<Response> { return handlerInput.responseBuilder .speak('Welcome to periodic table!') .reprompt('How can I help?') .getResponse(); } }
  23. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Test Code const alexaTest = new AlexaTest(skillHandler, skillSettings); describe('Test the LaunchRequest', () => { alexaTest.test([ { request: new LaunchRequestBuilder(skillSettings).build(), says: 'Welcome to periodic table!', shouldEndSession: false, }, ], 'should start correctly'); });
  24. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Test code with slots alexaTest.test([ { request: new IntentRequestBuilder(skillSettings, 'GetElementAttributeIntent') .withSlotResolution('attribute', 'Mass', 'AttributeName', 'mass') .withSlotResolution('element', 'Hydrogen', 'ElementName', '1') .build(), says: 'The mass of hydrogen is <say-as interpret-as="unit">1u</say-as>', shouldEndSession: true, }, ], 'should handle filled slot (mass) correctly');
  25. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Test code with multiple requests alexaTest.test([ { request: new LaunchRequestBuilder(skillSettings).build(), says: 'Welcome to periodic table!', shouldEndSession: false, }, { request: new IntentRequestBuilder(...), says: 'The mass of hydrogen is <say-as interpret-as="unit">1u</say-as>', shouldEndSession: true, }, ], 'should handle attribute request from LaunchRequest');
  26. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Running tests in your IDE
  27. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Test code with DynamoDB describe('SayGoodbye', () => { alexaTest.test([ { request: new IntentRequestBuilder(skillSettings, 'SayGoodbye').build(), says: 'Bye John!', shouldEndSession: true, withStoredAttributes: { name: 'John', }, }, ]); });
  28. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Test code with AudioPlayer describe('PlayStreamIntent', () => { alexaTest.test([ { request: new IntentRequestBuilder(skillSettings, 'PlayStreamIntent').build(), playsStream: { behavior: 'REPLACE_ALL', url: 'https://superAudio.stream', token: 'myStreamToken', }, }, ]); });
  29. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Test code with ProfileAPI describe('LaunchRequest', () => { alexaTest.test([ { request: new LaunchRequestBuilder(skillSettings).build(), withProfile: { givenName: 'John', name: 'Smith', }, says: 'Hello, John Smith.', repromptsNothing: true, shouldEndSession: true, }, ]); });
  30. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Using bespoken.io
  31. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. Testing using Bespoken --- configuration: locale: en-US --- - test: "Sequence 01. Test scenario: launch request, no further interaction." - LaunchRequest: - response.outputSpeech.ssml: "Here's your fact" - response.card.type: "Simple" - response.card.title: "Space Facts" - response.card.content: "/.*/" # Regular expression indicating any text will match
  32. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Running the test
  33. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.
  34. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Deployment Stages Source Build Test Production
  35. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Deployment Stages Source • Check in new code to Git Build • Run linters • Transpile Code • Create deployment package Test • Run Unit Tests Production • Deploy to Lambda • Deploy to Alexa
  36. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Deployment Stages Github CodeBuild CloudFormation
  37. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Deployment Stages Github • Voice Model • Skill Manifest • Lambda Code • CFN Templates CodeBuild • Run tests • Transpile TS • SAM package CloudFormation • Deploy SAM • Deploy Alexa
  38. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Export Voice Model
  39. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.
  40. Thank you! S U M M I T © 2019,

    Amazon Web Services, Inc. or its affiliates. All rights reserved. Thorsten Höger @hoegertn www.taimos.de
  41. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.