Selenium for Chatbots — Introducing Botium

No comments

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.

&TLDR; Selenium is the de-facto-standard for testing web applications. Appium is the de-facto-standard for testing smartphone applications. Botium is for testing chatbot applications.

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')
.setCapability(Capabilities.FACEBOOK_SEND_DELIVERY_CONFIRMATION, false)
.setCapability(Capabilities.CLEANUPTEMPDIR, false)
.setSource(Source.GITURL, '') .setSource(Source.GITPREPARECMD, 'npm install') .setCapability(Capabilities.STARTCMD, 'node index.js') .setEnv('NODE_TLS_REJECT_UNAUTHORIZED', 0)
.setEnv('NODE_ENV', 'dev')
.setEnv('page_token', 'sample')
.setEnv('verify_token', 'sample')
.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:

  1. Botium is told that the chatbot is a Facebook chatbot, developed with the Facebook Messenger Platform SDK
  2. The code has to be pulled from Github
  3. Installation commands, startup commands and environment settings are added
  4. A conversation is started with the chatbot
  5. 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 Tools

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

This article provides only a short overview of the involved components. Check the Github repositores (TestMyBot, Botium) for more resources.

We are looking for contributors! Please join the Github projects to help everyone building rock-solid chatbots! Contact hello “at” for questions.

magnoliaSelenium for Chatbots — Introducing Botium

Related Posts

Leave a Reply