Forum Discussion

jayakotib4u's avatar
jayakotib4u
Occasional Contributor
9 years ago
Solved

How to add reference of other units from one project suite into another suite?

Hi, i have some generic methods in different units in Test complete as shown below:

TestProject1(pjs)

Unit1:

Function fun1_1()
'do something
End Function

Function fun1_2()
'do something
End Function

Unit2:
'UserUnit Unit1
Function fun2_1()
'do something
End Function

Function fun2_2()
'do something
End Function

Unit3:
'UserUnit Unit1
Function fun3_1()
'do something
End Function

Function fun3_2()
'do something
End Function

WrapperUnit:
'UserUnit Unit1
'UserUnit Unit2
'UserUnit Unit3
Function WrapperFun1_1()
   Call fun1_1()
End Function
Function WrapperFun1_2()
   Call fun1_2()
End Function
Function WrapperFun2_1()
   Call fun2_1()
End Function
Function WrapperFun2_2()
   Call fun2_2()
End Function
Function WrapperFun3_1()
   Call fun3_1()
End Function
Function WrapperFun3_2()
   Call fun3_2()
End Function

Now i could just use only WrapperUnit(where all units references added) to access methods of all units.
But in other Project(pjs) file, if i want to access the methods in above units by only using WrapperUnit, how could i do it? please suggest me. When i include only WrapperUnit in new project suite file, it is also asking for other units to be reference.

Regards,
Jayakoti

  • Add usenet statment on first line of script unit. The following allows access to code in Purchasing.sj. Please mark as solution if this solves your problem.

     

    //USEUNIT Purchasing

  • Here's the starting point within the documentation for the script extensions. http://support.smartbear.com/viewarticle/69987/

     

    You've already done the hard part: writing your code.  All you need to do is write up the XML file, and package it all up.  You'll need to rename your unit files to .js from .sj.  Please, please, please remember that you cannot call other script extensions from with your script extension, and you cannot call back to your project from the script extension. 

     

    Here's the link for the description.xml structure: http://support.smartbear.com/viewarticle/68445/

     

    When you've got the files ready, just zip them up and put the zip package in the ScriptExtensions folder with a .tcx extension.

     

9 Replies

  • william_roe's avatar
    william_roe
    Super Contributor

    Add usenet statment on first line of script unit. The following allows access to code in Purchasing.sj. Please mark as solution if this solves your problem.

     

    //USEUNIT Purchasing

    • jayakotib4u's avatar
      jayakotib4u
      Occasional Contributor

      Hi William i didn't get what exactly you are saying. i have already tried below one, but it didnot work:

       

      In TestProject2(pjs file), -> under script Unit1:

      'UseUnit WrapperFunction

       

      In this case it is still asking for adding scripts (Unit1,23) using Add -> existing item. Idea here is to avoid adding the scripts(unit1, Unit2 and Unit3 from TestProject1 again in current project - TestProject2).

       

      Hope you got it.

       

      please refer the attachment for more details.

       

      Regards,

      Jayakoti