Forum Discussion

RUDOLF_BOTHMA's avatar
RUDOLF_BOTHMA
Community Hero
5 years ago

Run KeywordTest from imported project

Afternoon folks.  Back after a break with a new question.

Our organisation has a few products, developed by different teams.  Each product has had it's own development and testing.  This means each product has it's own project in TC.  The product I work on has dependencies on quite a few of our other products.  I work on a Web application, but it depends on setup in a Winforms application.  I need my KWTs to work in both, but I don't want to go redo all the work other developers/testers have already done.  How do I call a KWT from a imported project in one of my keyword tests.  I know for scripts, you need to duplicate it in some manner.  Will I have to recreate each test with the associated object mapping and aliases to my project, or is there a way to call the Keyword test from the imported project from a keyword test in mine.  I really would prefer not to have to duplicate the work other's have done and maintain changes on my end each time they modify a KWT on their end

  • Marsha_R's avatar
    Marsha_R
    5 years ago

    You know, though, that as soon as you start converting/wrapping/scripting things that now you have something else to maintain that won't update when the original test does.  At that point you might as well just cut and paste it into your project and forget the sharing part.

     

    In these cases I used to make a hybrid name mapping.  Create an empty project (to avoid stepping on your live one) and put your name mapping in there.  Merge it with the one from the shared test.  You can delete all the extra sections it adds except for what you need for that test.  Then backup the name mapping in your live test and put the hybrid one in and see if everything still runs.  It should be pretty close.

     

  • If you are using a Project Suite to hold both your project and the imported one, then you can share tests between the projects without duplicating the code.

    https://support.smartbear.com/testcomplete/docs/testing-with/creating/importing.html

     

    You can try running them without doing anything else, but depending on the differences in your name mapping, you may need to merge yours with a copy of the one that the other project uses.  Be very careful doing that, backup both name mapping files first in case you want to back it out.

    • RUDOLF_BOTHMA's avatar
      RUDOLF_BOTHMA
      Community Hero

      Thanks Marsha_R 

       

      I don't look forward to that excercise.  What I am aming for at present is to drag in a KWT from a referenced project into a KWT from my own project.  If you work inside your local project, you simply drag your KWT/add operation.  It's at this point where I would like to put in that KWT from the referenced project.  I'm not sure it can be done, but it's worth asking.  Perhaps The KWTs in the referenced project need to be converted to scripts so I can call the scripts from some sort of wrapper at least ?  Or perhaps I could call a KWT from a referenced project using aforementioned wrapper script ?

      • Marsha_R's avatar
        Marsha_R
        Moderator

        You know, though, that as soon as you start converting/wrapping/scripting things that now you have something else to maintain that won't update when the original test does.  At that point you might as well just cut and paste it into your project and forget the sharing part.

         

        In these cases I used to make a hybrid name mapping.  Create an empty project (to avoid stepping on your live one) and put your name mapping in there.  Merge it with the one from the shared test.  You can delete all the extra sections it adds except for what you need for that test.  Then backup the name mapping in your live test and put the hybrid one in and see if everything still runs.  It should be pretty close.