How do I integrate a virtual machine into my automated unit tests in Visual Studio?

I have some legacy software that I would like to include in an automated unit test (to check network protocol compatibility), and since this software is outdated and works in a legacy environment, I would like to encapsulate it in a virtual machine. What is the best way to manage a virtual machine from a Visual Studio unit test? Once I have configured the vm and saved the state accordingly, I will need to start and stop the vm and possibly start some programs inside the vm on command.

One of my considerations is that I would like to prevent developers from having to load the vm image unless they plan to run this test. So the unit test can also handle loading the last vm image from some location. Our convention is to tag long-term tests with a special description so that developers can exclude that test during active development.

0


source to share


1 answer


Virtual machine platforms provide a scripting API that allows you to manage virtual machines from the command line. VMware Server Documents and Videos on Hyper-V Script .

You will need to include some logic in your build scripts to decide whether to run the virtual machine code or just check for a virtual machine on the developer machines.



You can check out some of the NAnt and MSBuild task repositories for VM related tasks to make this easier.

+1


source







All Articles