top of page
Writer's pictureYash Agarwal

Use Power Automate (UI Flows) to perform automated testing on Power Virtual Agents

In this #PowerShot, let's see how UI Flows in Power Automate can be used to perform automated testing on Power Virtual Agents. We will deploy a bot in Power Virtual Agents on a web application and create a UI Flow to mimic user actions and interact with the bot.


Let's Get Started!


We will create a chat bot with Power Virtual Agents that performs basic operations such as interacts with the customer to get their concern and saves it on a SharePoint list. The bot also provides with a feature where the customer can track their previous requests with the appropriate request ID.


We will then look at a Flow in Power Automate that runs on a schedule and triggers a UI flow that performs the actions to create a new request and track a previous request on the bot. Based on this action, if it is successful, the flow sends an email to the concerned team that the test was successful and in case of a failure it creates a work item in Azure DevOps and sends the information to the concerned team as an email.

 

Power Virtual Agents


We will continue using the framework that I have created earlier for the Power Virtual Agents. Here is the post that explains how you can create one: Getting started with MS Power Virtual Agents on the Power Platform

Here, I have created a bot using Power Virtual Agents that interacts with a customer and gets their details, concerns and saves it on a SharePoint list. An email notification is sent to the customer with the request ID details. One other functionality this bot supports is tracking of request IDs so the customer enters the request ID and the bot provides with the information related to it.

 

Power Automate


Step 1: Trigger: Recurrence: to run the flow on a pre-defined schedule.


Step 2: Action: Run a UI flow for web: select this action and start recording a new test scenario. Select the UI Flow of type web and provide the URL of the web-page where the bot is deployed. In the recording, both the cases i.e., to create a new request and to track a previous one are covered.



UI Flow Key Points (in context to this particular solution)


1. UI Flow recordings run very fast and the speed can be adjusted by providing delay between each step in the UI Flow action in Flow. This is not a recommended approach though. To maximize results and a better output experience, while recording, after providing the input to the bot wait for the bot to respond and then once the bot responds, identify common text and ask the recorder to verify that text before moving to the next action.


2. The step 26 in the below screenshot corresponds to the step where an ID response is generated in the bot and we are storing that. In the second scenario to track the request, we will be providing the same output. Therefor this text is recorded as "responseid" and is used later on in the step 35 as "${responseid}" to pass the appropriate ID to track the request.


//Parallel branch to run when the UI Flow run fails

This branch is run if the UI Flow fails at any step.


Step 3: Action: Send an email: To send an email when the UI Flow run fails. In the settings of this action, configure the "run after" to when the "UI Flow" step Fails, Skipped or is Timed Out.


Step 4: Action: Create a work item: To create a work item in Azure DevOps when the test fails and concerned team engineers are notified about the issue and can track work done on that with this ticket/ work item.


Step 5: Action: Terminate: To terminate the flow as succeeded.



//Parallel branch to run when the UI Flow succeeds

Runs when the UI Flow run has succeeded.


Step 6: Send an email: To send an email that the UI Flow test has succeeded.


Step 7: Get item: To get the item created in SharePoint as a part of the test.

Step 8: Action: Update item: To update the item in SharePoint and mark status as completed with comments that the particular item was created as a part of the routine test.

 

In this post we saw how UI Flows can be used to perform basic testing on Power Virtual Agents. UI Flows can be used to mimic any repetitive user actions and perform such automation with ease. Combining this capability with the 300+ connectors of Power Automate makes this setup more powerful.


Upon test failure, one could create an Azure DevOps Task/ User Story, Planner Task, Jira tickets, Service Now tickets (based on the platform used in the organization) for better test fail analysis, work tracking etc.


I hope you found this interesting and it helped you. Thank you for reading!

Recent Posts

See All

Commenti


bottom of page