Test summary trend sample report
Azure DevOps Services
This article shows you how to create a report that shows day wise trend of number of total failed tests and test pass rate for a pipeline.
An example is shown in the following image.

Important
Power BI integration and access to the OData feed of the Analytics Service are in Preview. The sample queries provided in this article are valid only against Azure DevOps Services and depend on v3.0-preview or later version. We encourage you to use these queries and provide us feedback.
Specifically, you'll find sample queries for the following reports:
- Test summary trend for build workflow
- Test summary trend for release workflow
- Test summary trend for a particular branch
- Test summary trend for a particular test file
- Test summary trend for a particular test owner
Prerequisites
- You must be a member of a project with Basic access or higher. If you haven't been added as a project member, get added now. Anyone with access to the project, except stakeholders, can view Analytics views.
- For Analytics data to be available, the corresponding service must be enabled. For example, to query work tracking data, Boards must be enabled. If it is disabled, Analytics views won't be displayed. To re-enable a service, see Turn an Azure DevOps service on or off
- To use Analytics views, enable the Analytics Views preview feature either for individual users or for the organization.
- Also, you must have your *View Analytics permission set to Allow. For more information, see Grant permissions to access the Analytics service.
- To use Power BI for Azure DevOps or to exercise an OData query for Analytics, you must must have your View Analytics permission set to Allow. By default, all Contributors with Basic access are granted access. To edit shared Analytics views, you must have your Edit shared Analytics views permission set to Allow. For more information, see Grant permissions to access the Analytics service.
Sample queries
Note
This article assumes you've read Overview of Sample Reports using OData Queries and have a basic understanding of Power BI.
You can paste the Power BI query listed below directly into the Get Data->Blank Query window. For more information, review Overview of sample reports using OData queries.
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v4.0-preview/TestRuns?
$apply=filter("
&"Pipeline/PipelineName eq '{pipelineName}' "
&"and CompletedOn/Date ge {startdate} "
&"and Workflow eq 'Build' "
&") "
&"/groupby( "
&"(CompletedOn/Date), "
&"aggregate( "
&"ResultCount with sum as ResultCount, "
&"ResultPassCount with sum as ResultPassCount, "
&"ResultNotExecutedCount with sum as ResultNotExecutedCount, "
&"ResultNotImpactedCount with sum as ResultNotImpactedCount, "
&"ResultFailCount with sum as ResultFailCount "
&")) "
&"/compute( "
&"iif(ResultCount gt ResultNotExecutedCount, ((ResultPassCount add ResultNotImpactedCount) div cast(ResultCount sub ResultNotExecutedCount, Edm.Decimal)) mul 100, 0) as PassRate) "
,null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4])
in
Source
Substitution strings
Each query contains the following strings that you must replace with your values. Don't include brackets {} with your substitution. For example if your organization name is "Fabrikam", replace {organization} with Fabrikam, not {Fabrikam}.
{organization}- Your organization name{project}- Your team project name{pipelinename}- Your pipeline name. Example:Fabrikam hourly build pipeline.{startdate}- The date to start your report. Format: YYYY-MM-DDZ. Example:2021-09-01Zrepresents September 1, 2021. Don't enclose in quotes or brackets and use two digits for both, month and date.
Query breakdown
The following table describes each part of the query.
Query part
Description
$apply=filter(
Start filter()
Pipeline/PipelineName eq '{pipelineName}'
Return test runs for the specified pipeline
and CompletedOn/Date ge {startdate}
Return test runs on or after the specified date
and Workflow eq 'Build'
Return test runs for 'Build' workflow
)
Close filter()
/groupby(
Start groupby()
(CompletedOn/Date),
Group by the date of completion of test run
aggregate(
Start aggregate. For all the test runs matching the above filter criteria:
ResultCount with sum as ResultCount,
Count the total number of test runs as ResultCount.
ResultPassCount with sum as ResultPassCount,
Count the total number of passed test runs as ResultPassCount.
ResultNotExecutedCount with sum as ResultNotExecutedCount,
Count the total number of not executed test runs as ResultNotExecutedCount.
ResultNotImpactedCount with sum as ResultNotImpactedCount
Count the total number of not affected test runs as ResultNotImpactedCount.
ResultFailCount with sum as ResultFailCount
Count the total number of failed test runs as ResultFailCount.
))
Close aggregate() and groupby()
/compute(
Start compute()
iif(ResultCount gt ResultNotExecutedCount, ((ResultPassCount add ResultNotImpactedCount) div cast(ResultCount sub ResultNotExecutedCount, Edm.Decimal)) mul 100, 0) as PassRate
For all the days, calculate Pass rate.
)
Close compute()
Query filters
To determine available query filters, query the metadata as described in Explore the Analytics OData metadata. You can filter your queries using any of the NavigationPropertyBinding Path values listed under an EntitySet. To learn more about the data type of each value, review the metadata provided for the corresponding EntityType. Each EntitySet corresponds to the singular value for an EntityType.
For example, the EntitySet Name="TestPoints" corresponds to the EntityType Name="TestPoint". The OData metadata for the EntitySet Name="TestPoints" is as shown below for v4.0-preview. You can add filters based on any of the listed NavigationPropertyBinding Path values.
<EntitySet Name="TestPoints" EntityType="Microsoft.VisualStudio.Services.Analytics.Model.TestPoint">
<NavigationPropertyBinding Path="ChangedOn" Target="Dates"/>
<NavigationPropertyBinding Path="Project" Target="Projects"/>
<NavigationPropertyBinding Path="TestSuite" Target="TestSuites"/>
<NavigationPropertyBinding Path="TestConfiguration" Target="TestConfigurations"/>
<NavigationPropertyBinding Path="TestCase" Target="WorkItems"/>
<NavigationPropertyBinding Path="Tester" Target="Users"/>
<NavigationPropertyBinding Path="AssignedTo" Target="Users"/>
<Annotation Term="Org.OData.Display.V1.DisplayName" String="Test Points"/>
</EntitySet>
Power BI transforms
The query returns some columns that you need to expand and flatten into its fields before you can use them in Power BI. In this example, such an entity is CompletedOn.
After closing the Advanced Editor and while remaining in the Power Query Editor, select the expand button on CompletedOn.
Expand the CompletedOn column
Choose the expand button

Select the checkbox "(Select All Columns)" to expand

The table now contains the expanded entity CompletedOn.Date.

Change column type
Change the type of column PassRate to Decimal Number.

Rename fields and query, then Close & Apply
When finished, you may choose to rename columns.
Right-click a column header and select Rename...

You also may want to rename the query from the default Query1, to something more meaningful.

Once done, choose Close & Apply to save the query and return to Power BI.

Create the report
Power BI shows you the fields you can report on.
Note
The example below assumes that no one renamed any columns.

For a simple report, do the following steps:
- Select Power BI Visualization Line and stacked column chart.
- Add the field "CompletedOn.Date" to Axis.
- Right-click "CompletedOn.Date" and select "CompletedOn.Date", rather than Date Hierarchy.
- Add the field "PassRate" to Line values.
- Right-click "PassRate" field and ensure Sum is selected.
- Add the field "ResultFailCount" to Column values.
- Right-click "PassRate" field and ensure Sum is selected.
Your report should look like this.

You can use the following other queries to create different but similar reports using the same steps defined previously in this article.
Test summary trend for Release workflow
You may want to view the test summary trend of a pipeline for Release workflow, instead of Build workflow.
You can paste the Power BI query listed below directly into the Get Data->Blank Query window. For more information, review Overview of sample reports using OData queries.
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v4.0-preview/TestRuns?
$apply=filter("
&"Pipeline/PipelineName eq '{pipelineName}' "
&"and CompletedOn/Date ge {startdate}) "
&"/groupby((Workflow, CompletedOn/Date), "
&"aggregate( "
&"ResultPassCount with sum as ResultPassCount, "
&"ResultNotExecutedCount with sum as ResultNotExecutedCount, "
&"ResultCount with sum as ResultCount, "
&"ResultNotImpactedCount with sum as ResultNotImpactedCount, "
&"ResultFailCount with sum as ResultFailCount)) "
&"/compute( "
&"iif(ResultCount gt ResultNotExecutedCount, ((ResultPassCount add ResultNotImpactedCount) div cast(ResultCount sub ResultNotExecutedCount, Edm.Decimal)) mul 100, 0) as PassRate) "
,null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4])
in
Source
Filter by branch
You may want to view the test summary trend of a pipeline for a particular branch only. To create the report, carry out the following extra steps along with what is defined previously in this article.
- Expand Branch into Branch.BranchName
- Select Power BI Visualization Slicer and add the field Branch.BranchName to the slicer's Field
- Select the pipeline from the slicer for which you need to see the outcome summary
You can paste the Power BI query listed below directly into the Get Data->Blank Query window. For more information, review Overview of sample reports using OData queries.
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v4.0-preview/TestRuns?
$apply=filter("
&"Pipeline/PipelineName eq '{pipelineName}' "
&"and CompletedOn/Date ge {startdate} "
&"and Workflow eq 'Build') "
&"/groupby((Branch/BranchName, CompletedOn/Date), "
&"aggregate( "
&"ResultPassCount with sum as ResultPassCount, "
&"ResultNotExecutedCount with sum as ResultNotExecutedCount, "
&"ResultCount with sum as ResultCount, "
&"ResultNotImpactedCount with sum as ResultNotImpactedCount, "
&"ResultFailCount with sum as ResultFailCount)) "
&"/compute( "
&"iif(ResultCount gt ResultNotExecutedCount, ((ResultPassCount add ResultNotImpactedCount) div cast(ResultCount sub ResultNotExecutedCount, Edm.Decimal)) mul 100, 0) as PassRate) "
,null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4])
in
Source
Filter by test file
You may want to view the test summary trend of a pipeline for a particular test file only. To create the report, carry out the following extra steps along with what is defined previously in this article.
- Expand Branch into Test.ContainerName
- Select Power BI Visualization Slicer and add the field Test.ContainerName to the slicer's Field
- Select the pipeline from the slicer for which you need to see the outcome summary
You can paste the Power BI query listed below directly into the Get Data->Blank Query window. For more information, review Overview of sample reports using OData queries.
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v4.0-preview/TestResultsDaily?
$apply=filter("
&"Pipeline/PipelineName eq '{pipelineName}' "
&"and CompletedOn/Date ge {startdate} "
&"And Workflow eq 'Build') "
&"/groupby((Test/ContainerName, Date/Date), "
&"aggregate( "
&"ResultPassCount with sum as ResultPassCount, "
&"ResultNotExecutedCount with sum as ResultNotExecutedCount, "
&"ResultCount with sum as ResultCount, "
&"ResultNotImpactedCount with sum as ResultNotImpactedCount, "
&"ResultFailCount with sum as ResultFailCount)) "
&"/compute( "
&"iif(ResultCount gt ResultNotExecutedCount, ((ResultPassCount add ResultNotImpactedCount) div cast(ResultCount sub ResultNotExecutedCount, Edm.Decimal)) mul 100, 0) as PassRate) "
,null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4])
in
Source
Filter by test owner
You may want to view the test summary trend of a pipeline for tests owned by a particular test owner only. To create the report, carry out the following extra steps along with what is defined previously in this article.
- Expand Branch into Test.TestOwner
- Select Power BI Visualization Slicer and add the field Test.TestOwner to the slicer's Field
- Select the pipeline from the slicer for which you need to see the outcome summary
You can paste the Power BI query listed below directly into the Get Data->Blank Query window. For more information, review Overview of sample reports using OData queries.
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v4.0-preview/TestResultsDaily?
$apply=filter("
&"Pipeline/PipelineName eq '{pipelineName}' "
&"and CompletedOn/Date ge {startdate} "
&"And Workflow eq 'Build') "
&"/groupby((Test/TestOwner, Date/Date), "
&"aggregate( "
&"ResultPassCount with sum as ResultPassCount, "
&"ResultNotExecutedCount with sum as ResultNotExecutedCount, "
&"ResultCount with sum as ResultCount, "
&"ResultNotImpactedCount with sum as ResultNotImpactedCount, "
&"ResultFailCount with sum as ResultFailCount)) "
&"/compute( "
&"iif(ResultCount gt ResultNotExecutedCount, ((ResultPassCount add ResultNotImpactedCount) div cast(ResultCount sub ResultNotExecutedCount, Edm.Decimal)) mul 100, 0) as PassRate) "
,null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4])
in
Source
Full list of Pipelines sample reports
Pipeline
Pipeline and test
Related articles
Povratne informacije
Pošalјite i prikažite povratne informacije za