Botium - 处理不同的响应集

Botium - handle different set of responses

使用 Botium 我可以处理不同的响应集吗?我的意思是不同的计数。

对于相同的输入文本,有时我会收到两个回复,有时我只会收到一个回复​​。如果成功,聊天机器人将 return 两次响应,失败时将一次响应。

如果我总是得到一个响应,但只是响应值不同,我可以使用话语文件来添加所有这些不同的响应。

但是如果计数本身会有所不同,我该如何处理呢?

这是两个不同的测试用例,应该这样处理 - 两个不同的会议。从测试自动化的角度来看,当使用聊天机器人跟踪给定的记录时,无法决定记录是应该继续还是应该等待额外的响应。

例如:

#me
hello bot

#bot
hello

#bot
how are you

#me
please tell me the weather

如果机器人有时发送 "how are you" 有时不发送,Botium 应该如何知道何时应该继续发送 "please tell me the weather"?它应该为 "how are you" 等待两秒钟吗?还是应该等待 8 秒以等待另一个响应,然后再继续对话?

2020 年 3 月更新

你不能用 Fluent 界面做你想做的事,但使用异步 BotiumDriver API 是可能的(turn 函数只是发送文本并接收答案).

const driver = new BotDriver()
const container = await driver.Build()
await container.Start()

let answer = await turn(container, "order number 1")
if (answer.startsWith("here are the details for order")) {
  await turn(container, "thank you")
} else {
  await turn(container, "thanks for nothing")
}

为了展示如何使用 Botium Core 处理此问题,这里有一些示例代码:https://repl.it/@FlorianTreml/replit-botium-bindings-albie-1