'Selenium screenshots in VSTS (Azure DevOps)

According to my searches, it should "just work". This is the best article I found. I've followed the steps, but nowhere in the VSTS (Azure DevOps) interface does it indicate there are any screenshots attached.

I am running this on a privately hosted build server and I have verified the following:

  1. Screenshots are being created and saved to disk
  2. The resulting TRX file (I'm using MSTEST framework) does have a ResultFile reference (a path to the image file)
  3. The TRX file is uploaded to VSTS and I can download it and see that the ResultFile is still in the TRX.

I'm not sure what I am missing in order to get this to work. Any help would be appreciated.



Solution 1:[1]

This is a known issue and Microsoft says it is fixed but pending release in a future update: Azure DevOps build test results missing attachments from tests

The work-around in the response notes says to use the option to Rerun failed tests.

Solution 2:[2]

Related tasks for publishing artifacts

Use these tasks to publish artifacts. Is unfortunately well hidden in the docus.

icon Utility: Copy Files By copying files to $(Build.ArtifactStagingDirectory), you can publish multiple files of different types from different places specified by your matching patterns.

icon Utility: Powershell Create a PowerShell Inline Task to delete the files after copy

Remove-Item –path "Path to your screenshots" –recurse

icon Utility: Publish Build Artifacts With this task the will publish as test artifacts

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ryan Riehle
Solution 2 Glorfindel