用python开发的alexa skills kit sdk测试alexa skills的框架。
py-ask-sdk-test的Python项目详细描述
py_ask_sdk_测试
这是一个测试alexa技能的框架,它是在python中用alexa-skills-kit-sdk-for-python开发的,主要是typescript中taimos Alexa Skill Test Framework的翻译,它本身基于brian macintosh的alexa-skill-test-framework。
框架使用assert检查预期的行为。所以最好的方法是和pytest一起使用。
它所基于的ask sdk版本是ask-sdk-core=1.10
、ask-sdk-runtime=1.10
和ask-sdk-model=1.11
。
安装:
您可以通过pip安装框架:
pip install py_ask_sdk_test
示例:
您可以在下面和框架的test-files中看到使用框架的示例:
frompy_ask_sdk_test.alexa_testimportAlexaTestfrompy_ask_sdk_test.classesimportTestItem,SkillSettings,SupportedInterfacesfromrequest_builders.launch_request_builderimportLaunchRequestBuilderfromrequest_builders.intent_request_builderimportIntentRequestBuilderfrompseudo_handlerimporthandlerskill_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.)deftest_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)])