Forum Discussion

mwalia's avatar
mwalia
Occasional Contributor
6 years ago
Solved

Sharing test scripts between multiple projects

Hi, I am trying to create two projects say Project 1 and Project 2 using Python in TestComplete 12. I want to achieve method calling that is created in Project 1 into my Project 2.   e.g. Pro...
  • tristaanogre's avatar
    6 years ago

    The most reliable way of sharing a code unit between projects is to Add -> Existing item a script unit.  This is the tried and true way.  While using "import" allows you to import the code without having to share the file, as noted, it's not always visible that the file is in use.  Additionally, the "import" needs to make sure that the necessary file is in the same path.  Adding the existing item brings the file into both projects which allows you to edit it in both places.... with a caveat... that you need to make sure that any edits you make don't adversely affect the other project.

     

    See https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-project.html

  • tristaanogre's avatar
    tristaanogre
    6 years ago

    1) No... they part of the project, therefore they are visible somewhere.  Please keep in mind, there is no concept of a "parent" project in TestComplete.  You have a project where you're developing the shared code, and projects that consume it.  There's no parent/child relationship between the two there's no basis for hiding it.

     

    2) There is no "import" dialog available for Python.  This is a JavaScript only feature of TestComplete.  To share code between units IN THE SAME PROJECT for python, see https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/python.html