Forum Discussion

Ravik's avatar
Ravik
Super Contributor
12 years ago
Solved

Calling Object from one unit to another unit.

Hi All,



I want to call, Object from one unit to another unit. I have define Unit A  and Unit B

in Unit A I have search something. like



Sub Test

Dim cmbLnkDropDown

cmblnkPropName = Array("ObjectType","ObjectIdentifier")

cmblnkPropVal = Array("Select","cmbLinkages")

 Set cmbLnkDropDown = Sys.Process("iexplore", 2).Page(aqString.Concat(Project.Variables.URL,"*")).Panel("main").FindChild(cmblnkPropName,cmblnkPropVal,100)

End Sub



Unit A Run SuccessFully



Now I want to call Object of Unit A into Unit B like below -



Sub Test2

 UnitA.Test  ---------(This Statement run successfully)

 IF cmbLnkDropDown.Exists Then      -------(Throw Exception- Object Required)

       log.Message("You Done")

       Else

       log.Message("Well Try")

 End If

End Sub



Is there any way to call object from one unit to another unit,



Please suggest, thanks for Help in Advance.

  • Declare your object as Public as shown below. this you should declare outside your test.



    Public cmbLnkDropDown 

    Sub Test



    ----

    ---


    End Sub
  • Have you included UnitA in UnitB?



    In JScript this would be like this:



    //USEUNIT UnitA



    at the top of UnitB
  • abhijit_jain's avatar
    abhijit_jain
    Occasional Contributor
    Declare your object as Public as shown below. this you should declare outside your test.



    Public cmbLnkDropDown 

    Sub Test



    ----

    ---


    End Sub
  • Ravik's avatar
    Ravik
    Super Contributor
    Thanks Tony and Abhijit. it's work for me.