This post is the third in a series of posts about how Azure Test Plans can be used for deployments to various Data Platform related services. With each example using a different type of test suite. I covered test suites in a previous post about Azure Test Plans jargon.
My first one in this series was an Azure Test Plans example for Azure Data Factory. Followed by my second one which was an Azure Test Plans example for Azure Synapse Analytics.
In this post, I cover an Azure Test Plans example for Power BI. So that by the end of this post you will know how to use query-based suites in Azure Test Plans. In addition, some of you will be introduced to Power BI features.
I did this series for a few reasons.
Firstly, because I want to do a series of posts about how Azure Test Plans can be used for deployments to various Data Platform services. So that others gain ideas of how to use Azure Test Plans.
Secondly, I want to introduce some services to people because I know some people have not seen them before. Finally, because I promised a Data Platform MVP that I would do a Power BI example, which I will cover in this post.
Brief overview about Power BI
Power BI is commonly used as a data visualization service to create powerful reports and dashboards and use. Most people tend to do this using a combination of the Power BI Desktop and Power BI cloud service. In addition, you can do other things like create Power BI apps.
In reality, there is a lot more to Power BI than just a frontend to do data visualization. I know Nikola Ilic has been covering this in his blog series about building an end-to-end analytical solution using Power BI.
If you want to learn about Power BI, I have a customized collection in Microsoft Learn you can use called ‘Absorb Power BI‘. In addition, Pluralsight has a useful path called ‘Microsoft Power BI for Analysts‘.
Why use Azure Test Plans with Power BI?
In reality, you can use Azure Test Plans with Power BI to check a lot of things. For instance, you can use Azure Test Plans to check the contents of one or more Power BI reports that are being worked on.
In addition, if you are delivering reports as part of a bigger delivery you can have a test case to test that report along the way. It can be a lot more efficient then using spreadsheets for test plans.
Azure Test Plans example for Power BI
I am going to base this example on a Power BI report I created in another post.
It showed how you can create one Power BI report for both Azure Boards and GitHub. By linking work items in Azure Boards to information in a GitHub repository. It’s easier to do that now using Power BI Desktop because there is now a GitHub connector in Beta as you can see below.
In addition, I am going to use a query-based test suite for this example. So that it automatically includes both existing and new test cases for reports that use data from both Azure DevOps and GitHub.
Using query-based test suites allows you to have test cases for reports from certain sources stored together within one test suite. For instance, this example will show all the test cases for reports based on data from both Azure DevOps and GitHub.
What to test in Azure Test Plans?
In this Power BI example, there are various things I want to test in Azure Test Plans.
One thing I want to check that the data is joined together correctly. For this example, I will join the data from Azure DevOps and GitHub together by name.
I can start to do this when we first import the data into Power BI Desktop by replacing the usernames from one of the two services. Otherwise, there can be a mismatch in usernames. Which means that I won’t be able to join the data from Azure DevOps and GitHub together properly.
I can do this quickly in Power BI Desktop by using Power Query Editor. Which I can open by clicking on the Transform Data button as below.
Once Power Query Editor is opened, I can change the username by right clicking the user column and selecting ‘Replace Values’
As you can see above, I can also do a lot of other things with the columns as well using the context menu. Once done I can click the ‘Close & Apply’ button to go back to the main Power BI Desktop screen.
Power BI Model
In addition to making sure the usernames are the same in both services I must link the different sources together. I can do this by creating relationships in the Model section in Power BI Desktop, as below.
Those of you with a data platform background and are new to Power BI might be familiar already with the layout of the model section. Especially if you have worked with diagrams before.
In addition, it uses concepts that are used with relational databases such as cardinality. For example, the below shows a basic example of the relationship between the contribution details in GitHub and the backlog items in Azure Boards. With the user and Assigned To columns both showing as selected.
For more information, Microsoft provides an introduction about Model relationships in Power BI Desktop.
In reality, there are some differences about best practices when working with Power BI Models. However, the common theme is to get the model right from the start.
Azure Test Plans
Now let’s cover how I set up the Azure Test Plans for this. First, I go into Azure Boards within Azure DevOps. From there, I go to the Work items so I can quickly check if any Test cases have been created with certain tags. For this example, the tags are Azure DevOps, GitHub and Power BI.
It’s entirely up to you what tagging method you use. My advice is to keep your tags as simple as possible. It makes it a lot easier for new members of your team to pick them up.
If I open up the test case as it is and expand the steps section, you can see it has various steps attached to it.
In case anybody is wondering, there are a couple of steps lower down in this test case. Which relate to checking that the report opens correctly. With the last step containing the below image as an attachment. It’s an image of how the report looks when it’s published in Power BI.
Azure Test Plans
After checking that a test case exists, I can start to create my query-based suite. First, I go go into Azure Test Plans. From there, I can create a new test plan and go into it. I can then create a query-based suite by clicking on the ellipsis and selecting ‘New Suite’ as below.
Once I click on ‘Query based suite’ the below appears. Which may look familiar to those of you who have worked with query designers before.
To target test cases with specific tags I add filters for the three tags I found in the test case earlier and group them together. I can also change the name of the test suite to something more sensible, as you can see below.
At the bottom you can see that when I run the query, I get one result. I then select and click the ‘Create suite’ button that’s at the bottom of the designer. Which creates the below suite with my test case inside it.
New test case for Power BI
So, the big question now is what happens if I create a new test case for a new report with the same tags?
Well, to test this I created a new test case for another sprint that contained the same tags as below.
I then checked my test suite and saw that the new test case has been added, as you can see below.
Now, one thing to realize is that even though your new test case appears here it may also automatically appear in a new test plan. Which has been automatically created.
Using Azure Test Plans for Power BI standards
On a side note, another thing you can test for in Azure Test Plans are Power BI standards.
For example, say that you have multiple backlog items to create new Power BI reports. You want to test that settings like font sizes and colours used are the same across all the reports.
One way you can do this is to create a requirements-based suite to identify all the backlog items for the new reports. You can create a test case that checks for all your standards. Which you can then copy to the other test suites that are created.
You can read more about how to do this in my post showing an Azure Test Plans example for Azure Synapse Analytics.
I hope this Azure Test Plans example for Power BI has been an interesting insight.
Because, I had three aims for this post. To give others’ ideas about how Azure Test Plans can be used with Power BI, introduce some to parts of Power BI and to keep a promise.
Of course, if you have any comments or queries about this post feel free to reach out to me.