Giter Club home page Giter Club logo

py_ask_sdk_test's Introduction

py_ask_sdk_test

This is a framework for testing Alexa Skills developed in Python with the alexa-skills-kit-sdk-for-python, which is mostly a translation of taimos' Alexa Skill Test Framework in Typescript, which itself is based on the alexa-skill-test-framework by Brian MacIntosh.

The framework uses assert to check the expected behaviour. So the best way to go is using it with pytest.

The ask-sdk version it is based on is ask-sdk-core=1.10, ask-sdk-runtime=1.10 and ask-sdk-model=1.11.

Install:

You can install the framework via pip:

pip install py_ask_sdk_test

Example:

You can see an example for using the framework in the following and in the framework's test-files:

from py_ask_sdk_test.alexa_test import AlexaTest
from py_ask_sdk_test.classes import TestItem, SkillSettings, SupportedInterfaces
from request_builders.launch_request_builder import LaunchRequestBuilder
from request_builders.intent_request_builder import IntentRequestBuilder
from pseudo_handler import handler


skill_settings = SkillSettings(app_id="<Your skill's id>",
                               user_id="<Your user id>",
                               device_id="<Your device id>",
                               locale="<The locale of your skill>",
                               interfaces=SupportedInterfaces())  # interfaces your skill supports (audio, video etc.)


def test_launch_request():
    """Tests the LaunchRequest's speech and repromt output"""
    alexa_test = AlexaTest(handler)
    alexa_test.test(
        [
            TestItem(
                LaunchRequestBuilder(skill_settings).build(),
                expected_speech="Salve, gaudeo te videre!",
                expected_repromt="Vin aliquid dicere?",
                check_question=False
            ),
            TestItem(
                IntentRequestBuilder("DeiIntent", skill_settings).build(),
                expected_speech=(r"Jupiter.+", True),
                expected_repromt="",
                check_question=False
            )
        ]
    )

py_ask_sdk_test's People

Contributors

banananosh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

utmostzl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.