October 26, 2021

Enable video recording while executing test scripts using selenium .Net in Visual Studio

  October 26, 2021

 Logs are the perfect way to know what went wrong during the execution. What if we don't understand the error shown in the log?

A video recording of the execution will be the exact thing we may need in this scenario.

Visual Studio 2017 version 15.5 onwards supports this functionality inbuilt.

We just need to enter the configuration in the .runsettings file under DataCollectionRunSettings tag.

Enter the below code in your runsettings file and execute the test, this will add an attachment of video recording as part of the test output.

<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">
        <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>

We change the size of the file by changing parameters in the runsettings file.
logoblog

Thanks for reading Enable video recording while executing test scripts using selenium .Net in Visual Studio

Previous
« Prev Post

No comments:

Post a Comment

Bookmark this website for more workarounds and issue fixes.

Verify Zip file contents without extracting using C# + Selenium

While doing automation testing, we may get a scenario where we need to download a zip file and to validate the contents inside it. One way t...