This website contains affiliate links. See the disclosure page for more details.
If you are building a commercial grade Dialogflow chatbot, you should definitely consider adding some regression testing to your chatbot.
What is regression testing?
The idea behind regression testing is that you will run a series of tests and verify if the performance of your chatbot is consistent over time.
How to do regression testing in Dialogflow?
You will make use of the /query endpoint in the REST API exposed by Dialogflow.
By writing scripts which will send specific, pre-determined user phrases to the /query endpoint, you can verify if the phrases are getting mapped to the same intent (by using the intentID).
Why do regression testing
This brings us to the next question: why should you do regression testing for your Dialogflow chatbot? I will provide you a few reasons why it would really help.
1 Keep the chatbot’s behavior consistent as you make changes
You will keep modifying your chatbot over time once users interact with it. How do you know if a recent change you made didn’t break some existing conversation flow that worked well previously? By setting up regression tests, you can confidently make changes to your chatbot
2 Dialogflow updates
Sometimes, the Dialogflow team makes updates and changes to their service, and occasionally it has ended up changing the behavior of their own entity detection.
To guard against these kind of issues, you can set up regression tests that verify if the most important entity detection you wish to do is running consistently. In other words, if the city “Chennai” was being recognized as @sys.geo-city before Dialogflow rolled out an update, you want to make sure it is still being recognized as an entity of the same type after the update is rolled out.
3 Adjust your ML Threshold score
You might be familiar with the ML Threshold score setting in your Dialogflow agent.
When you do your regression tests, you can inspect the JSON response to see the score associated with an intent match. Watch the video below to understand how this works.
For a group of phrases, suppose the lowest matching score is 0.75. This means you can afford to set the ML threshold fairly high, say 0.5, because the matching score is well above such a threshold for most of the phrases you are interested in. (Of course, this also depends on how flexible you want your chatbot to be)
4 Improve your chatbot’s functionality
When your user’s phrase gets mapped to a Fallback intent, that phrase can be used in either an existing intent or added to a new intent to improve the functionality of your chatbot.
If you already had regression tests in place, you will do this analysis a lot more systematically, which means your chatbot’s functionality is continuously improving over time.
5 Reverse Engineer your chatbot’s behavior
One nice thing about setting up a large set of regression test phrases is that as you gain more experience building out your regression test cases, you will also be able to reverse engineer your agent’s behavior quite a bit. Considering that Dialogflow is not open source and its Machine Learning is a bit of a black box, you can learn a lot by doing some text analysis on top of your regression tests.
Want to see some examples of reverse engineering which will give you more insights into Dialogflow’s intent mapping? Check out my Dialogflow Tips course (specifically, the “Dissecting Intent Mapping” section)
The recently released Zoho SalesIQ v2 allows non-programmers to build chatbots using an easy-to-use code less bot builder. What is really unique about Zoho SalesIQ is the fact that you can also integrate AI into their code less bot builder. In my Zoho SalesIQ chatbots course, I explain how to use Zoho SalesIQ to add a chatbot to your website.
"The magic key I needed as a non-programmer" The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn. - Kathleen R Cofounder, gathrHealth