How to publish html reports in azure pipelines? - azure-devops

I want to take up other reports like extent report in selenium needs to be taken into azure pipelines to see the different results than azure default one.

Publishing html report in Azure pipelines which is not support at present. There has been a related user voice:
Support for generic HTML Publishing inside Build and Release Pipelines
https://developercommunity.visualstudio.com/content/idea/491426/support-for-generic-html-publishing-inside-build-a.html
You could vote up it and our PM will kindly review it. In other words, html reports for selenium automation test could not view inline as a web page at the moment. As a workaround, you have to download the html report files locally and check it.

Related

How to add HTML reports present in agent filesystem as an attachment to release pipeline logs in Azure DevOps?

A scan task of release pipeline in Azure DevOps generates the report and saves it to the local file system of agent. Is there any approach using which we can obtain the result report from the agent machine and access it directly from log attachments?
Yes, artifacts are not supported in a release pipeline as of now.
As per this thread regarding publishing/downloading artifacts in release pipelines, this feature has been proposed on the Developer Community.
For a workaround, if you wish, you can try third-party extension from the marketplace.
You can use AddAttachment task command.
Usage
Upload and attach attachment to current timeline record. These files are not available for download with logs. These can only be referred to by extensions using the type or name values.
Properties
type = attachment type (Required)
name = attachment name (Required)
Example
##vso[task.addattachment type=myattachmenttype;name=myattachmentname;]c:\myattachment.txt
Based on my understanding, artifacts are not supported in a release pipeline as of now. Few options that will come handy are:
Copy or publish the reports to blob storage services from a cloud provider.
Use 'Send Email' task to send the report as an attachment. To use this, an SMTP server has to be setup. Please find below URL for details:
https://marketplace.visualstudio.com/items?itemName=rvo.SendEmailTask

Showing Code Coverage Report with Azure DevOps

I'm using Microsoft Unit Tests to validate my solutions via Azure DevOps Pipelines. I am able to see tests being executed and the % of code coverage
However, I can't see the code coverage results (or they won't render)...
Here is my publish code coverage task - am I missing something to have it render here?
This is a known issue on Azure devops. Now, we could only download the report, and open it with Visual Studio.
Azure devops only support the download link for .coverage files currently. The white page you see is a UI glitch. This scenario is only supposed to render a download link to the coverage file.
Besides, this issue has been submitted in this earlier suggestion ticket linked here:
support vstest .coverage "code coverage" build results tab
This feature request is On Roadmap, I believe it will be released soon, you can follow this thread to know its latest feedback.
In addition, we found a similar case and I have tested via the answer, set the code coverage tool to Cobertura, then I get the code coverage report in the Azure DevOps pipeline.

AzDO YAML pipeline publish Html test result

Azure DevOps still doesn't have a built in way to publish test html reports to the pipeline. This request is over a year old now and still no announcement on it being on the roadmap.
This article suggests it is possible by naming the file index.html. However, I'm not seeing how the file is published - can anyone help?
Sorry, for now we do not have any build-in feature to directly publish html file and have the ability to view the HTML report inline as a web page on Azure pipelines.
Azure DevOps Coverage page show index.html on the web. However, the
CSS and Javascript should be included. For this purpose we can use
HTMLInline to include CSS and Javascript on the index.html.
The article you are referring, seems related to code coverage not test page. There is a code coverage tab next to Tests tab.
According to the description, the workaround seems to modify the original index.html file of Code Coverage and display something on it. If so, there is no need to publish, Azure DevOps will find the index.html and auto display info of it.
That's not a common way to publish html report. Suggest you use Publish Pipeline Artifact task to publish generated html reports and then download to view them locally.
Or you could also give a try with 3rd-party extension-- Publish HTML

Azure DevOps add custom Tab to Build Summary

I want to add a custom tab to my build summary.
Inside these tab I want to display the results of the PowerShell Test Code Coverage task. The results are about 50-200 *.htm reports generated by ReportGenerator.
I try to achive with Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=Report;]$localFile" but the amount of reports make this option not senseful.
Best case solution would be, if could display the reports like:
AssemblyNameA.dll collapsed:true
index.htm collapsed:false
TargetAssemblyA.htm
TargetAssemblyB.htm
TargetAssemblyC.htm
AssemblyNameB.dll collapsed:false
index.htm collapsed:false
TargetAssemblyA.htm
TargetAssemblyB.htm
TargetAssemblyC.htm
Is there a way to implement that?
Azure DevOps add custom Tab to Build Summary
First, I suppose you are using Azure DevOps Server 2019. Am I right? This is a known issue for Azure DevOps Server 2019:
Code coverage tab missing in Azure DevOps Server
A fix for this issue has been released! Install the most recent
release from https://visualstudio.microsoft.com/downloads/.
Second, if you want to create a real custom summary tab, just like Wouter said, you need to write an extension by Visual Studio Services Web Extension SDK.
MS team has provided a great sample on github Build Results Enhancer, you can check this sample for some more details.
Hope this helps.
To publish the coverage reports created by ReportGenerator you can use the Publish Code Coverage Results task. You need to make sure the format that ReportGenerator creates matches to what the Publish Code Coverage Results task expects.

Azure devops pipeline get work items between builds

I'm looking for a pre-made option to take 2 builds, and compare the work items or PRs completed between them. i know there are REST API options in order to find out this information ( https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20work%20items%20between%20builds?view=azure-devops-rest-5.0 ) , but i would rather not build my own app for this if one already exists. Is there something built into azure devops that shows this information, preferably in an exportable format? Is there possibly an existing devops extension in the store? Any searching i do just brings up the REST API call and nothing else unfortunately.
They seem to have changed it in Azure DevOps. We are using Azure DevOps Server (on-prem). In it, the old TFS-like work items comparison between the builds is possible when you actually deploy (execute a release) in a stage:
(in the screenshot below the right popup pane is showing the work item "diff" between the build currently deployed in TEST and the one which is about to be deployed now)
If you are open to it being generated at build time, you could look at using the Generate Release Notes Build Task from the marketplace.