Browse DevX
Sign up for e-mail newsletters from DevX


The Right and Wrong Virtual Machine Uses in Development and Testing : Page 2

As much time and money as virtual machines can save you in your software development and testing processes, they're not the right choice for every scenario.


Development and Testing Uses for Virtual Machines

The following sections describe the different ways that you can use virtual machines for development and testing.

Create a Library of Virtual Hard Disks
As previously mentioned, you can create a library of virtual hard disk (.vhd) files that you and your colleagues can use to "instantly" recreate a particular environment. Under Virtual Server and Virtual PC, you can do this by creating a virtual machine, installing the requisite software on it, and then cloning the .vhd file. You can attach the .vhd file to a new virtual machine, boot it up, and voila: your environment is running on the new virtual machine.

If you want to run more than one virtual machine with the same .vhd on the same network, you must sysprep the virtual machine to prevent network conflicts. For more information and instructions, see my blog post, "Sysprepping a virtual machine".

Create a Standardized IDE
With your IDE deployed in a virtual machine, you can quickly set up a development environment that meets your company's standards and even share it with colleagues in your .vhd library. If you work at home, you can install a virtual machine on your personal computer with the corporate "standard" environment so you can connect to the corporate network.

You can also sandbox the virtual machine, isolating it from your personal computer, to satisfy corporate security requirements. This blog post talks about sandboxing a virtual machine under Virtual PC. Also, see the Virtual Server 2005 Administrator's Guide for information on isolating the network traffic of your virtual machines from your host.

Test New Development and Test Tools
You can try out new tools for software development and testing on a virtual machine without jeopardizing your primary workstation setup. You can set up a .vhd file that has your basic environment installed, copy it, attach it to a new virtual machine, and boot it up. You can then install the new tools and see how they work in your environment.

Perform Functionality Tests
Use the following tips to make it quicker and easier to perform software functionality tests with virtual machines:
  • Deploy a variety of destination environments for functionality testing, using minimal hardware (as previously mentioned).
  • Set up a library of test environments in virtual machines for rapid deployment (also previously mentioned). Just copy the .vhd file, attach it to a virtual machine, and boot up.
  • Run tests and then quickly roll your virtual machines back to a clean state. You can do this with Virtual PC and Virtual Server thanks to a cool feature called "undo disks." I use it frequently to reinstall builds of software that are under development at Microsoft. To get back to a clean base where I can install the latest build, I do the following:
    • Install all of the prerequisites for my software.
    • Enable undo disks.
    • Install my software.
    When I want to go back to a clean base, I turn off the virtual machine and discard undo disks. (For complete information about using undo disks, see the Virtual PC or Virtual Server documentation.)
  • Test complex network scenarios without setting up a physical network. Thanks to the flexible virtual networking in Virtual Server, I can create a complete network setup on my test computer and keep all of the network traffic isolated to the physical box. I can even set up a domain, as I describe in this blog post.

What Not to Expect from Virtual Machines

While their benefits all sound ideal, virtual machines do have two main drawbacks: they share physical resources with the host and any other running virtual machines, and they carry some processing overhead. So you can't expect the same performance from a virtual machine as you do from a physical one. Because they contend for resources in this way, the following are not good uses of virtual machines:
  • Performance and stress testing. Your results may not be accurate because the amount of resources available for a given operation can fluctuate.
  • Running multiple resource-intensive virtual environments on the same physical computer. Performance will be sub-optimal unless your computer is sized adequately. Your host computer must have the sum of all of the physical resources required by the running virtual machines, plus what the host system needs, plus about another 10 percent for overhead. You'll have other considerations as well, such as disk I/O requirements. It isn't possible to give brief, general guidelines, so for details about this, see my blog post "Estimating System Capacity Requirements."

What does this mean to you? If you're a developer, limit the number of resource-intensive programs you run on a single computer. If you're a tester, you shouldn't try to use virtual machines for stress or performance testing. You should use physical computers for these purposes.

Megan Davis is a technical writer at Microsoft. She was a member of the Virtual Server 2005 and Virtual Server 2005 R2 product development team, and authors the blog, "The Soul of a Virtual Machine." Megan is currently working on the next release of Microsoft's business process management solution, BizTalk Server 2006.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date