Рекомендованный способ добавить свою собственную логику asserter в Botium - добавить свой собственный модуль asserter в Botium. Вы можете найти детали здесь , но вкратце:
- Создать файл MyCustomAsserter.js :
module.exports = class CustomAsserter {
constructor (context, caps, globalArgs) {
this.context = context
this.caps = caps
this.globalArgs = globalArgs
}
assertConvoStep ({convo, convoStep, args, isGlobal, botMsg}) {
if (botMsg.message !== 'hugo') throw new Error('expected hugo')
return Promise.resolve()
}
}
Зарегистрируйте его в
botium.json {
"botium": {
"Capabilities": {
...
"ASSERTERS": [
{
"ref": "MY-ASSERTER-NAME",
"src": "./MyCustomAsserter.js",
"global": false,
"args": {
"my-arg-1": "something"
}
}
]
}
}
}
Используйте этот asserter в ваших файлах convo:
my-test-case
#me
hi
#bot
hi
MY-ASSERTER-NAME some-arg1|some-arg2