Forum Discussion

jvkumar's avatar
jvkumar
Occasional Contributor
15 years ago

Referring VIX API in Test complete (To open vxm files)

Hi,



We have some image files (vmx files) created using VMware. And we need to open these files from Test complete. And i have installed VIX API in my system. However, the references are not updated. And the functions under this is not listed under .Net class.



Please let us know, how to install VIX API in testcomplete. We have Testcomplete 7.5 enterprise edition.



Please help us on this.



Regards,

Vijay

5 Replies


  • Hi,





    Please let us know, how to install VIX API in testcomplete.


    There is no way to do this. However, as far as I know, VIX API provides the "VixCOM.VixLib" COM object, so if this object provides automation interfaces (IDispatch, in addition to IUnknown), TestComplete should be able to work with this object via COM. For additional information see the "Working With COM Objects" help topic and VIX API Reference.
  • jvkumar's avatar
    jvkumar
    Occasional Contributor
    Hi Alex,



    Thanks for your reply.  Yes I know this can be achieved by using the COM object after I saw the sample code from the below link

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



    But my problem is though I have installed VIX  API in my system, it is not shown under Registered ActiveX Libraries of the Testcomplete project - ActiveXObjects.



    I couldn't refer VixCOM.VixLib from the Test Complete project as there is no COM reference for that.



    Can you please help me on this.



    Thanks and Regards,

    Vijay
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Vijayakumar,



    If some entity is registered as a COM object, there is no need for it to be added to TC ActiveX Objects. You just write the code that instantiates the needed COM object and use it via its methods and properties.

    E.g. (copied from the http://www.vmware.com/support/developer/vix-api/vix16_reference/, PowerOn function usage):



    [VBScript:]
    Dim lib
    Dim host
    Dim vm
    Dim err
    Dim results
    Dim job




    Set lib = CreateObject("VixCOM.VixLib") ' instantiate a COM object


    ' use obtained COM object
    Set job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, Empty, 0, Empty, Empty, 0, Nothing, Nothing)

    ' results needs to be initialized before it's used, even if it's just going to be overwritten.
    Set results = Nothing

    err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
    If lib.ErrorIndicatesFailure(err) Then
    ' Handle the error...
    End If

    Set host = results(0)

    Set job = host.OpenVM("C:\VMs\winxppro\winxppro.vmx", Nothing)
    err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
    If lib.ErrorIndicatesFailure(err) Then
    ' Handle the error...
    End If

    Set vm = results(0)

    Set job = vm.PowerOn(VixCOM.Constants.VIX_VMPOWEROP_LAUNCH_GUI, Nothing, Nothing)
    err = job.WaitWithoutResults()
    If lib.ErrorIndicatesFailure(err) Then
    ' Handle the error...
    End If

  • chriswal's avatar
    chriswal
    Occasional Contributor
     When i try your script i get this error.

    With vmrun i can start the vm


  • Hi,



    I recommend that you ask the VIX API support department to help you find out why the needed COM object has not been registered in your system.