This article shortly outlines the components and capabilities of Botium. Together with TestMyBot it provides a basic solution for automated testing of your Chatbot project.
The Botium Ecosystem
The Botium Driver API
Botium exports an easy-to-use API for automating starting, interacting and stopping your Chatbot application. Here is a short Botium script:
const driver = new BotDriver()
.setCapability(Capabilities.PROJECTNAME, 'Testmybot Sample Calculator')
.setCapability(Capabilities.FACEBOOK_API, true) .setCapability(Capabilities.FACEBOOK_WEBHOOK_PORT, 3000) .setCapability(Capabilities.FACEBOOK_WEBHOOK_PATH, 'facebook/receive')
.setSource(Source.GITURL, 'https://github.com/codeforequity-at/testmybot-sample-calculator.git') .setSource(Source.GITPREPARECMD, 'npm install') .setCapability(Capabilities.STARTCMD, 'node index.js') .setEnv('NODE_TLS_REJECT_UNAUTHORIZED', 0)
.WaitBotSaysText((text) => assert('I can do a very advanced scientific calculations for you ("Addition").', text)) .WaitBotSaysText((text) => assert('Please tell me the first number!', text))
.UserSaysText('1') .WaitBotSaysText((text) => assert('Please tell me the second number!', text))
.WaitBotSaysText((text) => assert('1 + 1 = 2', text)) .WaitBotSaysText((text) => assert('Is this correct ?', text)) .UserSaysText('yes')
.WaitBotSaysText((text) => assert('I know.', text))
What’s happening there is:
- Botium is told that the chatbot is a Facebook chatbot, developed with the Facebook Messenger Platform SDK
- The code has to be pulled from Github
- Installation commands, startup commands and environment settings are added
- A conversation is started with the chatbot
- Everything is stopped and cleaned afterwards
The API is aligned with Selenium and Appium — there are various capabilities to describe your chatbot application and the runtime environment.
The Botium Chatbot Sandbox
The chatbot application is placed in a safe sandbox environment with Docker containers. It doesn’t connect to any online services (Facebook Messenger Platform SDK, Microsoft Bot Framework, Slack API, …), but only talks to Botium Driver.
The Botium Grid and the Botium Agent
Botium Grid allows load distribution to Botium Agents, running on other machines, local or in the cloud. It helps speeding up parallel execution of your Botium scripts.
Botium Live Connectors
Botium can also connect to already deployed chatbot applications and run your Botium scripts against them.
The TestMyBot ecosystem
TestMyBot is a test automation library for chatbot conversations. It includes tools for recording and replaying conversations, and integrates with CT/CI/CD pipelines (Continuous Testing, Continuous Integration, Continuous Delivery).
Test Authoring Tools
Test authoring is hard work. TestMyBot includes a tool for recording your chatbot conversations and storing them as test cases.
Developer’s life is hard work, too. Chatbot development is made easier with the emulator tools included in TestMyBot. It helps speeding up the trial&error process known as software development.
CT/CI/CD — Continuous Testing / Integration / Delivery
TestMyBot contains helpers for some well-known test runners (Jasmine and Mocha), but can be included in other test runners and pipelines as well.
Next to Come
We are looking for contributors! Please join the Github projects to help everyone building rock-solid chatbots! Contact hello “at” testmybot.com for questions.