December 22, 2014
Hot Topics:

Automating Software Testing with Microsoft Hyper-V

  • November 19, 2008
  • By Jani Järvinen
  • Send Email »
  • More Articles »

Making sure your software works as it is designed can be tough work, especially if your application is more complex than the ubiquitous Hello World. This is because software works in the context of the operating system and even other applications, which in turn can interfere with your application. This is often the reason why problems at the customer's site are so hard to replicate.

Even though it is the custom of our profession not to give any warranties that applications would always work, software developers still need to make sure their applications work as planned on generic installations. In this testing, using virtual machines can be a big aid. With real hardware, you often find the need to reinstall the operating system, or hot-swap between hard disks to get yourself back to a clean state. Enter virtualization, and leave all that behind.

Testing in a Virtualized Environment

With virtual machines, re-running your tests is often a matter of returning the virtual machine installation to a clean state. A clean state is, in this case, for example a version of the virtual machine that doesn't have certain configurations done, or that your application hasn't yet been installed on it.

Depending on the virtual machine software you use, your also might be able to take snapshots. With snapshots, it is trivial to return a virtual machine to a previous, known state. For example, both Microsoft's Virtual Server and VMware's products, including Workstation, support this feature.

When you return to a snapshot, the virtual machine's hard disk (and memory, if the virtual machine was running at the point when the snapshot was taken) returns to the state it was when the snapshot was taken. This means that if you have, for example, installed applications or changed the configuration of the virtual system, you can undo all those changes and return to the previous snapshot state. Then, you can restart your tests, being absolutely sure no traces or Registry keys of the old installation are left behind (see Figure 1).



Click here for a larger image.

Figure 1: Snapshots, or checkpoints as they are also called, are very helpful in software testing.

Although all this sounds great, working with virtual machines and taking and restoring snapshots can be manual, repetitive work, and thus stealing time from real testing work. Luckily, new virtual machine software allows automation, and this can be key to more effective testing. This is especially true for server-based applications that do not have a user interface.

For example, you could create an automation script that returns a given virtual machine to a clean state, installs your application on the virtual machine, runs a test script, and then takes the results and stores them for later inspection.

When all this work is automated, you could, for example, run automatic application tests nightly, and on the morning of each day have a report telling whether the application worked as planned. If you would combine unit tests into this procedure, you could have a comprehensive set of tests: both at code level and at the runtime level.

Enter Hyper-V

If you have followed Microsoft's latest server features, you might have heard that Windows Server 2008 has built-in support for virtualization. Surely, you could download Virtual Server and install it on any Windows machine recent enough, and run your testing there.

However, the virtualization technique in Windows Server 2008, called Hyper-V, is much more advanced than Virtual Server (see Figure 2). For example, Hyper-V supports multiple processors, better management, and the x64 architecture. Thus, if you want to make sure your applications run properly on Windows Server 2008 (you should!), it's a great idea to set up your virtualization with Hyper-V, and run your tests there.



Click here for a larger image.

Figure 2: Hyper-V brings a lot of power to virtualization.





Page 1 of 4



Comment and Contribute

 


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

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel