testing - 具有自定义负载的 Botium - DefaultWelcome : bot says undefined

标签 testing dialogflow-es chatbot

我正在尝试使用 botium 测试我的应用程序。我已经使用 botium-cli import dialogflow-conversations

生成了 session 文件

我有 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

更新

您可以将 capabilitiy _DIALOGFLOW_FORCE_INTENT_RESOLUTION_ 设置为 true,甚至在连接器未识别任何已知内容时向 Botium 发送响应。那你还差一站。

为了实际断言响应,您可以使用集成的 JSON 结构匹配,但由于 Dialogflow 自定义负载结构的性质,您的 session 文件将变得非常困惑。

你的 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",
                                 }
                              }
                           },
                        }
                     }
                  },
               }
            }
         },
      }
   ]
}

关于testing - 具有自定义负载的 Botium - DefaultWelcome : bot says undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55275167/

相关文章:

ios - 动态类型和 iOS 模拟器 : How can I set the value?

sql - 为什么我的用户表没有列错误?

dialogflow-es - 在 dialogflow-fulfillment 中访问先前的跟进意图参数

node.js - Bot Framework Emulator 处理新成员的方式与 Bot Framework Webchat 不同吗?

node.js - 在 NodeJS 上为 Watson Conversation 配置 HTTPS

testing - Incisive Formal Verifier 安装 64 位

java - org.openqa.selenium.ElementNotVisibleException : Element is not currently visible and so may not be interacted with Command duration or timeout:

node.js - 代码正确运行并在控制台上打印成功消息,但不在应用程序中打印

firebase - Actions-on-Google user.storage 未保存在 Dialogflow SDK 上

python-3.x - Keras One Hot 编码内存管理 - 最好的出路