testing - 具有自定义有效负载的 Botium - DefaultWelcome:bot 说未定义
问题描述
我正在尝试使用 botium 测试我的应用程序。我已经通过使用生成了 convo 文件 botium-cli import dialogflow-conversations
我有以下有效负载的 DefaultWelcome 意图
{
"cutomPayload": {
"card": {
"description": "Hey there! I’m a bot that can help you troubleshoot issues with UPS. Please enter the model number"
}
}
}
和培训阶段如下
just going to say hi
heya
hello hi
howdy
hey there
hi there
greetings
hey
long time no see
hello
lovely day isn't it
I greet you
hello again
hi
hello there
a good day
在我的 convo 文件夹中,我有 DefaultWelcome.convo.txt 和 DefaultWelcome_input.utterances.txt
DefaultWelcome.convo.txt 有
DefaultWelcome
#me
DefaultWelcome_input
#bot
!INCOMPREHENSION
DefaultWelcome_input.utterances.txt 有
DefaultWelcome_input
just going to say hi
heya
hello hi
howdy
hey there
hi there
greetings
hey
long time no see
hello
lovely day isn't it
I greet you
hello again
hi
hello there
a good day
我试图运行
const BotDriver = require('botium-core').BotDriver;
const driver = new BotDriver();
driver.BuildFluent()
.ReadScripts('convos')
.Start()
.RunScripts()
.Exec().then(() => {
console.log('READY')
})
.catch((err) => {
console.log('ERROR: ', err)
});
但不幸的是我得到了以下输出
botium-connector-dialogflow Start called +256ms
botium-ScriptingProvider Using utterances expansion mode: all +172ms
botium-Convo DefaultWelcome/Line 6: user says ConvoStep {
botium-Convo sender: 'me',
botium-Convo channel: null,
botium-Convo messageText: 'just going to say hi',
botium-Convo sourceData: undefined,
botium-Convo stepTag: 'Line 6',
botium-Convo not: false } +0ms
botium-connector-dialogflow UserSays called +175ms
botium-connector-dialogflow dialogflow request: {
botium-connector-dialogflow "session": "projects/joules-test/agent/sessions/defee8a0-4b08-11e9-93e7-fd1394066413",
botium-connector-dialogflow "queryInput": {
botium-connector-dialogflow "text": {
botium-connector-dialogflow "text": "just going to say hi",
botium-connector-dialogflow "languageCode": "en-US"
botium-connector-dialogflow }
botium-connector-dialogflow },
botium-connector-dialogflow "queryParams": null
botium-connector-dialogflow } +0ms
botium-connector-dialogflow dialogflow response: {
botium-connector-dialogflow "responseId": "27545943-441c-487f-9f45-2cd32e833ace",
botium-connector-dialogflow "queryResult": {
botium-connector-dialogflow "fulfillmentMessages": [
botium-connector-dialogflow {
botium-connector-dialogflow "platform": "PLATFORM_UNSPECIFIED",
botium-connector-dialogflow "payload": {
botium-connector-dialogflow "fields": {
botium-connector-dialogflow "cutomPayload": {
botium-connector-dialogflow "structValue": {
botium-connector-dialogflow "fields": {
botium-connector-dialogflow "card": {
botium-connector-dialogflow "structValue": {
botium-connector-dialogflow "fields": {
botium-connector-dialogflow "description": {
botium-connector-dialogflow "stringValue": "Hey there! I’m a bot that can help you troubleshoot issues with Back-UPS. Please enter your model number",
botium-connector-dialogflow "kind": "stringValue"
botium-connector-dialogflow }
botium-connector-dialogflow }
botium-connector-dialogflow },
botium-connector-dialogflow "kind": "structValue"
botium-connector-dialogflow }
botium-connector-dialogflow }
botium-connector-dialogflow },
botium-connector-dialogflow "kind": "structValue"
botium-connector-dialogflow }
botium-connector-dialogflow }
botium-connector-dialogflow },
botium-connector-dialogflow "message": "payload"
botium-connector-dialogflow }
botium-Convo DefaultWelcome wait for bot null +3s
botium-BaseContainer WaitBotSays error Error: Queue.pop timeout after 60000
botium-BaseContainer at timeoutRequest (/Users/madhavam/joules-botium/node_modules/botium-core/src/helpers/Queue.js:46:18)
botium-BaseContainer at Timeout.timeoutCallback [as _onTimeout] (/Users/madhavam/joules-botium/node_modules/async/dist/async.js:4936:13)
botium-BaseContainer at ontimeout (timers.js:427:11)
botium-BaseContainer at tryOnTimeout (timers.js:289:5)
botium-BaseContainer at listOnTimeout (timers.js:252:5)
botium-BaseContainer at Timer.processTimers (timers.js:212:10) +0ms
botium-Convo DefaultWelcome: bot says undefined +1m
ERROR: Error: DefaultWelcome/Line 8: bot says nothing
at Object.fail (/Users/mma/joules-botium/node_modules/botium-core/src/scripting/ScriptingProvider.js:50:15)
at container.WaitBotSays.then (/Users/madhavam/joules-botium/node_modules/botium-core/src/scripting/Convo.js:64:49)
那么如何解决这个问题呢?无论如何我可以处理意图中的特定响应吗?
解决方案
不支持自定义有效负载是 Botium Dialogflow 连接器的当前限制之一,请参阅:https ://github.com/codeforequity-at/botium-connector-dialogflow#open-issues-and-restrictions
使用 Botium CLI 时,您无需编写任何 Botium 代码 - 您可以使用 cli 运行测试用例:
> botium-cli run --convos ./convos
更新
您可以将功能 _DIALOGFLOW_FORCE_INTENT_RESOLUTION_ 设置为 true,以在连接器无法识别任何已知内容时甚至向 Botium 发送响应。那你就差一站了。
对于实际断言响应,您可以使用集成的 JSON 结构匹配,但由于 Dialogflow 自定义有效负载结构的性质,您的 convo 文件将变得非常混乱。
您的 convo 文件应如下所示
DefaultWelcome
#me
DefaultWelcome_input
#bot
{
"fulfillmentMessages":[
{
"platform":"PLATFORM_UNSPECIFIED",
"payload":{
"fields":{
"cutomPayload":{
"structValue":{
"fields":{
"card":{
"structValue":{
"fields":{
"description":{
"stringValue":"Hey there! I’m a bot that can help you troubleshoot issues with Back-UPS. Please enter your model number",
}
}
},
}
}
},
}
}
},
}
]
}
推荐阅读
- windows - 使用 net 调试目标计算机 (VM) 时,WinDbg 失败并出现错误 0x80004005
- python - 将主代码中的 Print() 输出到 PyQT5 中的标签
- css - 将“重复”与“自动调整”和固定宽度列组合在一个“网格模板列”中
- flutter - google ml 套件安装包:google_ml_kit_example
- php - PHP读取在线Excel文件而不下载文件
- python - 看不到 2 个数据帧之间有什么区别
- reactjs - React 中的条件列表渲染
- c++ - OpenGL项目不会打开显示窗口
- python - 多处理查找进程索引?
- python - 在 Django 中,根据模型中其他字段中选择的值删除选择字段下拉列表中的选项