【问题标题】:Botium-Core - Need to assert only certain parts of alexa responseBotium-Core - 只需要断言 alexa 响应的某些部分
【发布时间】:2019-10-01 16:13:05
【问题描述】:
Alexa 中的实际响应
我:提供我的计划详情
Alexa:您已经注册了价值 78 美元的 creditlock 年度计划。您还想做什么?
Convo 文件
我#:提供我的计划详情
Bot# :您已注册 creditlock ,计划价值 $ ,您还想做什么?
I want to assert only the part of info which i've mentioned in the convo file .
Why I do this because in my application from user to User the plan and its cost changes.So globally i only check for the basic structure of the response message for smoke test purpose
【问题讨论】:
标签:
javascript
chatbot
alexa-skill
alexa-voice-service
【解决方案1】:
这可以通过SCRIPTING_MATCHING_MODE capability来控制。
在您的情况下,可以使用 wildcard 或 regexp(wildcard 从 Botium Box 1.8 开始可用)。
使用通配符,您可以使用星号 (*) 作为 convo 文件中所有内容的通配符。
#me
Give my plan details
#bot
You've enrolled in creditlock * plan worth * What else would you like to do?
使用 regexp,您必须使用成熟的正则表达式进行匹配 - 更复杂,但更强大。
#me
Give my plan details
#bot
You've enrolled in creditlock, \w+ plan worth \$[0-9]+ What else would you like to do \?
您必须注意正确引用所有要用作文字字符的正则表达式控制字符