Change Screen Resolution Open Source Tool for Visual Studio Lab Environments

Image

March 1, 2023

Virtual machines that are hosted on-premises and in Azure are great resources for building lab environments for use in automated testing. Lab Environments in Visual Studio 2012 and 2013 ALM provide two levels of functionality. Both Standard and SCVMM Lab Environments allow teams to execute workflows for build-test-deploy systems into test environments. SCVMM Environments utilize Hyper-V and provide some additional benefits of being able to snapshot and rollback environments. One use of these environments that I have helped clients implement, is building environments with only UI test clients to execute automated UI tests against an environment that is outside of the Lab Environment. This allows automated UI tests to be distributed across all of the machines in the environment to execute the tests in a shorter timespan.

One thing we discovered when running automated UI tests in the lab environments is that the resolution is 1024 x 768. While websites should provide a responsive interface, this is not the typical resolution of most users today. Furthermore, I may want to specifically test a series of different resolutions. Unfortunately there isn’t a way to change this through the environment settings nor on the local machines. I created a small utility that provides a mechanism for changing the screen resolution that can be run as part of the automatic login process. This utility changes the resolution to the specified setting.

changescreenresolution 1920 1080

Not all screen resolutions are supported by all virtual machines. In addition to changing the resolution, you can specify a SendGrid account to send an email with the default resolution, available resolutions, and the final resolution after the change. The formatting in the email is very simple but effective.

changescreenresolution_email.png

ChangeScreenResolution is a free and open source project hosted on GitHub at:

https://github.com/mikedouglasdev/changescreenresolution

You can download the files from my OneDrive account at:

http://1drv.ms/1DANxCV

To use, follow these steps:1. Copy the files to any location on the virtual machine.2. Optionally add the SendGrid account info to the config file and enable email

changescreenresolution_config.png

3. Create shortcut and add to startup folder (use shell:startup in Windows 8/8.1 to get to the startup folder)

changescreenresolution_shortcut.png

4. Add the desired resolution to the shortcut (1920 1080 is the default)

5. Restart Virtual Machine

changescreenresolution_restart_virtual_machine.png

Enjoy! Let me know if you want any additional features.