Necessitates Proper Modularity

    ask-sdk-test
    TypeScript icon, indicating that this package has built-in type declarations

    2.6.0 • Public • Published

    Alexa Skill Test Framework

    Build Status Build Status npm version

    This framework makes it easy to create full-coverage black box tests for an Alexa skill using Mocha.

    Here's an example of what a test might look like with the test framework.

    import {AlexaTest, IntentRequestBuilder, LaunchRequestBuilder, SkillSettings} from 'ask-sdk-test';
    import {handler as skillHandler} from './helloworld';
    
    // initialize the testing framework
    const skillSettings : SkillSettings = {
        appId: 'amzn1.ask.skill.00000000-0000-0000-0000-000000000000',
        userId: 'amzn1.ask.account.VOID',
        deviceId: 'amzn1.ask.device.VOID',
        locale: 'en-US',
    };
    
    const alexaTest = new AlexaTest(skillHandler, skillSettings);
    
    describe('LaunchRequest', () => {
        alexaTest.test([
            {
                request: new LaunchRequestBuilder(skillSettings).build(),
                says: 'Welcome to the Alexa Skills Kit, you can say hello!',
                repromptsNothing: true,
                shouldEndSession: true,
            },
        ]);
    });

    If you are writing your Alexa Skills in Python, check out https://github.com/BananaNosh/py_ask_sdk_test

    How To

    Install the package as a dev dependency with npm install ask-sdk-test --save-dev.

    Write tests in a Typescript file and run them with Mocha. For example, if your test is at 'test/skill.spec.ts', run mocha --require node_modules/ts-node/register/index.js test/skill.spec.ts.

    For some simple examples, see the 'examples' directory.

    History

    This framework is based on the alexa-skill-test-framework by Brian MacIntosh and rewritten for Typescript and the ASK SDK v2.

    Install

    npm i ask-sdk-test

    DownloadsWeekly Downloads

    125

    Version

    2.6.0

    License

    MIT

    Unpacked Size

    136 kB

    Total Files

    74

    Last publish

    Collaborators

    • hoegertn