Monday, October 14, 2019

Attach UI/Functional Test Run Video to Tests in Azure DevOps

When you have Automated test scripts integrated with Azure DevOps pipelines and run test scenarios using Test client machine, you can’t see what actually happens inside the test client machine. You only get the test run results at the end of the test run with all necessary details as execution time, failure test cases with failure reasons. To get more detail of the test scripts, we can attach screen shots and videos to the Azure DevOps pipelines test result section. This post explains how we can add test run video to the Azure DevOps pipeline.



Pre requisites:
  • Unit test project
  • Build to gather and publish build artifacts to pipeline
  • Release pipeline to run automated UI test
  • Test Client machine configured
  • Install Visual Studio 2017 or 2019 in Test client machine 
           
Let’s get started.
  • Open Unit test project and Add new runsettings file
  • Copy following content to the runsettings file.Set sendRecordedMediaForPassedTestCase to false to add attachments to failed tests only.
 <?xml version="1.0" encoding="utf-8" ?>  
 <RunSettings>  
  <!-- Configurations for data collectors -->  
  <DataCollectionRunSettings>  
   <DataCollectors>  
    <DataCollector uri="datacollector://microsoft/VideoRecorder/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder.VideoRecorderDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Screen and Voice Recorder">  
     <!--Video data collector was introduced in Visual Studio 2017 version 15.5 -->  
     <Configuration>  
      <!-- Set "sendRecordedMediaForPassedTestCase" to "false" to add video attachments to failed tests only -->  
      <MediaRecorder sendRecordedMediaForPassedTestCase="true" xmlns="">  
       <ScreenCaptureVideo bitRate="512" frameRate="2" quality="20" />  
      </MediaRecorder>  
     </Configuration>  
    </DataCollector>  
   </DataCollectors>  
  </DataCollectionRunSettings>  
 </RunSettings>  

·         Make sure to copy the runsetting file to build output.

·         Check in your changes to repository and queue new build to gather artifacts.



·         Once build completed, you would be able to see the runsettings file under artifacts

·         Open release pipeline in edit mode.

·         Select the runsettings file in the artifacts as follows


·         Now save the changes and trigger a release.
·         After Test execution completed, open the release.

·         Go to test tab. You would be able to see the test scripts listed

·         Select the test script. You would be able to see test attachment section.

·         Move to attachments. You would be able to see the attached test run video.


This post explained how to attach a video recording of the test run to Azure DevOps pipeline which would be really useful to identify issues in the application under test as well as identify any issues in test scripts

No comments:

Post a Comment