Teams App Test Tool – the new way to emulate Teams Bots
Quietly, Microsoft have released a brand new emulation tool for developers working with Microsoft Teams Bots that seeks to add more Microsoft Teams specific functionality than the existing Bot Framework Emulator.
The new tool is built into the Teams App Toolkit and can be set as the default debug launch experience in Visual Studio Code. Rather than being a stand-alone application, it’s actually a website (running locally) that emulates a Teams experience, with some extras:
You can send messages to your bot, and it’ll work exactly the same as the existing Bot Framework Emulator, even giving you the full request & response JSON in the panel on the right-hand side. Also, it’s fast. In my testing there was basically zero delay between sending a message to my bot and getting a response.
What makes this tool better though is its ability to mock Teams specific activities, such as installing a bot to a team, or uninstalling it. Both of these are actions that it’s really common to want to run code for, but it’s very hard to test that code until you actually install your bot into a Teams environment.
I’ve just come off a project that required me to collect information about the team and channel the bot was installed into, and this level of activity mocking would have been invaluable. As it was, I had to install the app and iterate through a series of dumping property values to confirm that I had what I needed.
Now though, there’s a “Mock an Activity” button which allows various different actions to be performed:
Each activity can be customised – there’s a default activity template which is displayed but which can also be changed. For instance, this is the “Install bot” template:
There’s full support for break & debug as well, so sending the activity above triggered a breakpoint that I had in my onInstallationUpdateAdd function:
There’s support for testing in personal chat, group chat as well as in Teams channels:
There are a few rough edges and limitations today, but for speed and convenience I can see this replacing the Bot Framework Emulator for many tasks. I would love to see this come to Visual Studio as well, as many larger bots end up being developed there, and this would be a really useful tool to have.
Get Started Today
If you’d like to try this out, you’ll need the latest pre-release version of the Teams Toolkit in Visual Studio Code. Once you’ve got that, create a new project, then look for the “Debug in Test Tool” option under “Run and Debug”. Helpfully, the Test Tool becomes the default experience for debugging.
What’s really nice as well is that all the new projects created with the Teams Toolkit have updated Readme information that incorporates the Test Tool and how to use it. That’s a nice touch and helps get going quickly:
Learn more about the new Teams Test App by reading the docs page for it: Debug bot using Teams App Test Tool – Teams | Microsoft Learn.