Forum Discussion

santoguya's avatar
santoguya
Contributor
14 years ago

Using Hyper-V for virtual machine testing

I'm using Hyper-V to manage and create virtual machine images, and I'm trying to figure out how to write a TestComplete script on a phsyical machine to execute Hyper-V, load an virtual image (image has a clean OS with TestExecute installed), and then kick off TestExecute on that virtual image.



I've looked through the article "Automating Testing in Virtual Labs" http://www.automatedqa.com/techpapers/testcomplete/automated-testing-in-virtual-labs/ and I see it can be done using VMWare.



Can the same thing be done with Hyper-V? Something like the following code:



Sub sub1



  Dim vmHost, vmMachine



  Set vmHost = dotNET.Vestris_VMWareLib.VMWareVirtualHost.zctor



  vmHost.ConnectToVMWareWorkstation



  Set vmMachine = vmHost.Open("c:\VMWare virtualmachines\vm1.vmx")



  vmMachine.PowerOn(5000)



  Call vmMachine.Login("tester", "password")



  vmMachine.PowerOff

End Sub



Thanks!

  • Hi Randy,





    Could you please describe the specific task you're trying to accomplish in detail?


  • The first sentence of my post describes it in detail but I will provide more info.



    1. Write a TestComplete script or keyword on a phsyical machine to launch/execute Hyper-V. When I try to do this via Keyword Test (click on Hyper-V on my desktop), it does not function properly. Hyper-V isnt an executable, its an MSC.



    2. Load an virtual image (image has a clean OS with TestExecute, my tested applications, and test cases installed) in Hyper-V using another script. Just like VMWare, once the virtual machine program is launched/executed, you can load a predefined virtual image. This script will probably contain calls to the Hyper-V COM APIs (like the code example I provide) but I do not know how to call into Hyper-V. It should be somethign like the API calls into VMWare like that code I provided?



    3. Kick off TestExecute on that virtual image. The TestComplete script from the physical machine needs to somehow invoke TestExecute on the virtual machine that I loaded.



  • Hi Randy,





    I'm not sure whether Hyper-V can be automated, however, if you need to launch TestExecute on a slave machine and control the test's execution from a master machine, you should consider using distributed testing. Please see the "Distributed Testing - Overview" help topic (http://www.automatedqa.com/support/viewarticle/11271/) for more information.