Here you find a quick introduction how to test your Facebook Chatbot with TestMyBot.
- 1:1 conversations
- Structured messages
- Webviews
- Payments
With Jasmine, the setup looks like this:
$ npm install testmybot --save-dev
$ npm install jasmine --save-dev
$ ./node_modules/.bin/jasmine init
Add a file named "testmybot.json" to your project directory. A very basic configuration for a Facebook Chatbot looks like this:
{
"botium": {
"Capabilities": {
"PROJECTNAME": "testmybot-sample1",
"FACEBOOK_API": true,
"FACEBOOK_WEBHOOK_PORT": 5000,
"FACEBOOK_WEBHOOK_PATH": "webhook",
"CLEANUPTEMPDIR": false,
"STARTCMD": "node index.js"
},
"Envs": {
"NODE_TLS_REJECT_UNAUTHORIZED": 0,
"NODE_ENV": "dev"
}
}
}
Take the Testmybot Jasmine Spec file from the sample and place it into your project directory (spec/testmybot.spec.js).
You can hand over environment variables to your chatbot here.
Now it's time to define your test cases. Please follow the guide in the section "How to Compose Test Cases" in the project description.
And finally, run your tests with Jasmine:
$ ./node_modules/.bin/jasmine
In the end, your Jasmine tests should succeed (of course).
In case of troubles, you can activate debug before starting your test cases:
$ export DEBUG=botium*