Forum Discussion

santoguya's avatar
santoguya
Contributor
15 years ago

Using VMWare COM API in TestComplete

In this article you discuss how to launch VMWare, load a virtual image, and power off a virtual machine using VMWare's COM API.



http://www.automatedqa.com/techpapers/testcomplete/automated-testing-in-virtual-labs/



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



I tried using this code in a test script and ran it and ran into this runtime exception:



"Object doesnt support this property or method: dotNET.Vestris_VMWareLib"



The article says "We use a .NET wrapper for VIX COM API to power on and then to power off a virtual PC" when referring to the above code. Since i have the VIX API installed, shouldn't TestComplete be able to recognize this .NET code? Or do I need to install something manually (install extensions, etc.)?



I have TestComplete 8.2, VMWare Workstation 7.1.3, and also installed VMWare VIX API 1.6.2 installed.



Thanks!

33 Replies

  • Hi,



    I am seeing attached errors while tring to connect to vmware workstation with vmx files locally.

    I am using Tc 8.7, VmareWorkstation 7.1.4.



    I have Vestris.Vmwarelib.dll added in CLR bridge. It does show vmware related functions in drop down for dotNet.

    Do I need any other setup ?



    If I use following vbscript code, It works perfectly fine.

    --------------------------

    Sub sub1

      Dim vmHost, vmMachine

      Set vmHost = dotNET.Vestris_VMWareLib.VMWareVirtualHost.zctor

      vmHost.ConnectToVMWareWorkstation

      Set vmMachine = vmHost.Open("C:\\Users\\ss001\\Documents\\Virtual Machines\\ATVMWINXP3X32\\ATVMWINXP3X32.vmx")

      vmMachine.PowerOn(5000)'

     End Sub

    -----------------------------

    If same code used in jscript, It complains. Refer attachments

    -----------------------------

    function tt()

    {

    var vmHost = dotNET.Vestris_VMWareLib.VMWareVirtualHost.zctor();

    vmHost.ConnectToVMWareWorkstation(); ==============> Error seen at this line

    //vmHost.ConnectToVMWareWorkstation()

    //vmMachine = vmHost.Open("C:\\Users\\ss001\\Documents\\Virtual Machines\\ATVMWINXP3X32\\ATVMWINXP3X32.vmx");

    //vmMachine.ShutdownGuest();

    //vmMachine.PowerOn(5000)

    }

    ------------------------------
  • Hi,



    See this thread. Also, there's no need to ask the same questions in different threads. This doesn't affect the speed of getting a reply, but it makes processing your requests more difficult and less efficient.
  • I'm wondering if there is going to be fix for the dotNET.Vestris_VMWareLib not working when .Net version 4 is installed.  



    I have version 9 of TC and this is still the case.



    Michael