Automating Microsoft Virtual Server

Microsoft has two free software virtualization products: Virtual PC 2007 and Virtual Server 2005. You can use either product to help perform configuration testing. The idea is to create multiple virtual machines, each with a different operating system, on a single physical machine, and then test your system under development on the different virtual machines. Both Virtual PC and Virtual Server are built upon the same underlying, core code. An advantage of Virtual PC is that it has a very clean and easy user interface. An advantage of Virtual Server is that it is fully automatable. However, I’ve been doing a deep dive into Virtual Server over the past week and have discovered it is surprisingly poorly documented from the perspective of automating software configuration testing. The problem is not that there isn’t enough documentation on Virtual Server — there is a ton of it — but rather a.) there are no complete end-to-end examples available, and b.) much of the existing information on the Internet is misleading or just plain incorrect. Anyway, I am putting together a complete (and hopefully accurate) article for MSDN Magazine which will help testers use Virtual Server for test automation. Here’s a brief example of what Virtual Server automation looks like using VBScript as the automation language, leaving out a lot of details:
‘ file: demo.vbs
Set objVS = CreateObject("VirtualServer.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
‘ use fso here to delete virtual machine, if it exists
Set objVM = objVS.CreateVirtualMachine("VirtualMachineName","D:\Someplace")
objVM.Memory = 256
‘ add and attach virtual hard drive here
‘ add and attach virtual CD drive here
‘ attach virtual network to default adapter
‘ copy test automation to guest machine here
‘ run  test automation
I expect to have an article for MSDN Magazine done in about three weeks, and an associated technical training class for engineers workng at Microsoft done about a week later. 
This entry was posted in Software Test Automation. Bookmark the permalink.