How to record Windows test machines with Dashcam

If you run UI tests on Windows machines, you might have trouble understanding what happened when those tests failed! When screenshots and logs aren't enough, use Dashcam to capture everything that happened on test machines.

Here's how to provision a Windows test machine to record UI tests at the desktop level with Dashcam.

Edit your VM snapshot

We're going to assume that you're in control of the VM state through some form of snapshotting. We recommend installing and configuring Dashcam as a part of your snapshot.

Install Dashcam Desktop

Download the Desktop Appfor Windows and install it on the test machine. Follow onboarding and ensure Dashcam launches in the tray bar.

Install the Chrome Extension (Optional)

Install the Dashcam Chrome Extension to capture console and network logs from the VM.

Configure Log Tracking

Configure Dashcam Logsto monitor any files you're wishing to view in sync with video. Remember to use the glob *pattern if your log names include a date or other unpredictable name.

If you expect your log configuration to change, you can also use the CLI to configure logs within your provisioning scripts.

Disable Dashcam Auto Update

Auto update might cause pop-ups or other disruptions. Run this command in powershell to prevent Dashcam from checking for updates.

New-Item  C:\Users\Switc\AppData\Roaming\Dashcam\.replayable--do-no-update

Make sure you're logged out

Log out of Dashcam using the menu if you're logged in.

Disable "Instant Replay"

Click the toggle button in Dashcam to disable Instant Replay. You won't need it.

Edit your provisioning script

Now it's time to edit the script that runs when your VM boots. The commands below should be run in order, within your provisioning script.

Install Dashcam

Dashcam CLI is distributed via NPM. Install it globally

npm install dashcam -g

Authorize Dashcam

Log into https://app.dashcam.io/team and copy the API Key.

Only the team admin can see the API key.

Add this command to automatically authorize the Dashcam desktop app

dashcam auth YOUR_API_KEY

We recommend storing this key as a secret within your runner. In GitHub actions, this would look like:

dashcam auth ${{ secrets.DASHCAM_API_KEY }}

Configure Log Tracking (Optional)

Use the CLI to track logs within your VM. If you didn't already configure log tracking from the GUI or want a standard way to maintain your log config, here's the place to do it.

Note that Dashcam will tail any logs provided here.

Tracking Logs From Desktop

dashcam track --name=test --type=application --pattern="C:\Users\Switc\OneDrive\Desktop\*.log*"

If the application you want to track logs from only writes to stdout but not a file, simply use Tee-Object when calling that command to redirect logs to a location that matches the glob pattern you defined.

Get-ChildItem C:\Windows\System32 | Tee-Object -FilePath 'C:\Users\Switc\OneDrive\Desktop\test.log'

Tracking Logs from Web

Note that this requires capturing logs via the Chrome Extension. The example below will track logs from both Facebook and Twitter.

dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"

Start Log Tracking

This command will start Dashcam recording.

dashcam start

Run your test

Do your thing!

Publish your Dash!

Run the command below after tests complete to upload your video to Dashcam.io. The command will hang while the video is uploaded and a link to the video (or markdown link) will be returned.

See CLI for more options.

  • -p is mandatory for recording on VMs (to upload the file)

  • --md will return a markdown embed you can use within results. Otherwise, a link will be returned.

dashcam -t "My Test Result" -p --md

This result stored as a variable in your CI/CD system. You can log it out, append it as a comment, update your test summary, etc.

Here is an example of using Dashcam within a GitHub action.

echo "dashcamMarkdown=$(dashcam -t '${{ inputs.repo }}/${{ inputs.branch }} ${{ inputs.issue }}' -p --md)" >> $GITHUB_ENV

The result can then be called with echo $dashcamMarkdown

Last updated