Using chatbots to automate testing
I guess most development teams use IM / chatrooms for general communication amongst the team. At Infraxis we do that too - we have a distributed team across the globe who work together on shared infrastructure to build, deploy and test our products.
There's often a point where there'll be a request in the chatroom like "can someone redeploy the QA environment" and then one of the team members will kick off a build in Jenkins, which runs an automated regression test too. That's ok - but if we automate it even further, then any member of the team can deploy and test rather than just those who have the relevant know-how - without learning anything about the deployment system or the testing harness. And if we could do it right there in the chatroom, we'd have full visibility of the outcome in the place we're already focusing on for communication. Hmmmm...
Hubot
Hubot is a scripted bot library, which can be integrated into all kinds of popular chat apps, and can automate almost anything.
Using Hubot, I built a wrapper for the API of our in-house collaborative Payments testing product "IQS" - just as a proof of concept to see if I could do it. Once you get used to coffee script it's quite straightforward - this uses just 18 lines of code.
IQS provides a RESTful test execution API, requiring two parameters - an access token, and a test scenario name - a short name for the test scenario to be run.
The Hubot script responds to the request "run iqs test [test scenario nickname]" . I deployed Hubot to Heroku, integrated the bot - which I called 'ixbot' - into Slack, pointed it at our IQS QA system and gave it a try :
I asked it to run the test scenario called "bot demo" for this test.
ixbot understood the command and kicked off the API call to IQS, responding immediately on receipt of the request, and getting back to me shortly afterwards with the outcome of the tests.
We'll continue expanding on this to completely integrate automated deployment and testing into our developer chatroom. Then it becomes extra easy to run automated tasks, regardless of the individual's skills.
CEO & Co-Founder | Owner Ptolemay | Life is too short to build shitty things
1 年Dan, thanks for sharing!
Automating Carbon Accounting
9 年ChatOps - like it Amancio, hadn't heard it given a name befire - I had a read about that term just now and found a good primer article : https://blogs.atlassian.com/2016/01/what-is-chatops-adoption-guide/
API & AI Enthusiast ★ Digital Products & Ecosystems ★ Dot Connector ★ Author of API Product Management & Speaker
9 年Thanks a lot for this article regarding ChatOps. Currently, some colleagues and me are working on a prototype in the context of continuous delivery.