This is a Botium connector for testing your Botkit chatbot over websockets.
Did you read the Botium in a Nutshell articles ? Be warned, without prior knowledge of Botium you won't be able to properly use this library!
This connector connects to websocket endpoint of Botkit web adapter.
It can be used as any other Botium connector with all Botium Stack components:
- Node.js and NPM
- a Botkit web socket Server
- a project directory on your workstation to hold test cases and Botium configuration
When using Botium CLI:
> npm install -g botium-cli
> npm install -g botium-connector-botkit-websocket
> botium-cli init
> botium-cli run
When using Botium Bindings:
> npm install -g botium-bindings
> npm install -g botium-connector-botkit-websocket
> botium-bindings init mocha
> npm install && npm run mocha
When using Botium Box:
TODO
Open the file botium.json in your working directory and add the Botkit chatbot connection settings.
{
"botium": {
"Capabilities": {
"PROJECTNAME": "<whatever>",
"CONTAINERMODE": "botkit-websocket",
"BOTKIT_SERVER_URL": "..."
}
}
}
Botium setup is ready, you can begin to write your BotiumScript files.
When using BotiumScript, you can assert quick replies visible texts and use a quick reply to respond with corresponding payload.
For asserting quick replies use BUTTONS Asserter:
#bot
Here are some quick replies
BUTTONS Foo|Bar
BUTTON takes quick reply visible text as a parameter and sends payload as user input
#me
BUTTON Foo
For setting websocket message fields, you have to use the UPDATE_CUSTOM logic hook. This example changes message type to hello and adds custom name field:
#me
UPDATE_CUSTOM SET_FIELD|type|hello
UPDATE_CUSTOM SET_FIELD|name|John
For asserting existence and values of websocket message fields, you can use the JSON_PATH asserter:
#bot
Please wait until I transfer you to someone who can help
JSON_PATH $.frontend_action|talk_to_agent
More examples can be found in tests/spec directory
Set the capability CONTAINERMODE to botium-connector-botkit-websocket to activate this connector.
The Botkit server url (without any path, just http/https, servername, port)