Forum Discussion

kyork's avatar
kyork
Occasional Contributor
6 days ago
Solved

Copy Keyword Test from one suite to another

Hi, is there an easy way to copy a TestComplete keyword test from one project suite to another so that I don't have to re-record it?  

  • Hello Kyork,  

    I will echo what Hassan​ wrote.  I will add and agree that the NameMap merge isn't easy.  The NameMapping gets messy it doesn't scale up well.  We went to script driven tests and stopped using the name map for this reason.  Keyword Tests and the Name Map are really good until you start trying to extend scope to other projects and scale.

    If you can copy and paste your test file and "Add Existing Item" or just copy the test text into the new project file, keep the name maps seperate, and just remap what you need that would be the cleanest way to go.

    The closest we came to a workable solution was a suite with a 'Master' or 'Template' project and a name map we would use to merge into new projects and a few other various things I don't currently remember.  Every project in that suite initially merged with the common NameMap and needed to be re-merged involving conflict resolution if changes needed to be made from or to the master project NameMap.

    • The merge is a one time operation.  It does not remained linked. It must be repeated if you want to update one file or the other file.
    • It is also a one way merge.  You choose the source and destination and then manually resolve the conflicts as they occur.  That is where it gets messy especially with several projects.

    Always use a version control system like git.  You will need it.

    ... If you find my posts helpful drop me a Like👍 Be sure to mark the post as the Solution✅ when you get one to help others out and to credit the one who helped you. 😎

6 Replies

  • scot1967's avatar
    scot1967
    Icon for Champion Level 3 rankChampion Level 3

    The copy paste is a pretty solid option to save some work depending on how similar the projects are.  You will have to manually map the objects with the Object Spy so it may be the same either way.  Thanks and have great day!    

  • scot1967's avatar
    scot1967
    Icon for Champion Level 3 rankChampion Level 3

    Hello Kyork,  

    I will echo what Hassan​ wrote.  I will add and agree that the NameMap merge isn't easy.  The NameMapping gets messy it doesn't scale up well.  We went to script driven tests and stopped using the name map for this reason.  Keyword Tests and the Name Map are really good until you start trying to extend scope to other projects and scale.

    If you can copy and paste your test file and "Add Existing Item" or just copy the test text into the new project file, keep the name maps seperate, and just remap what you need that would be the cleanest way to go.

    The closest we came to a workable solution was a suite with a 'Master' or 'Template' project and a name map we would use to merge into new projects and a few other various things I don't currently remember.  Every project in that suite initially merged with the common NameMap and needed to be re-merged involving conflict resolution if changes needed to be made from or to the master project NameMap.

    • The merge is a one time operation.  It does not remained linked. It must be repeated if you want to update one file or the other file.
    • It is also a one way merge.  You choose the source and destination and then manually resolve the conflicts as they occur.  That is where it gets messy especially with several projects.

    Always use a version control system like git.  You will need it.

    ... If you find my posts helpful drop me a Like👍 Be sure to mark the post as the Solution✅ when you get one to help others out and to credit the one who helped you. 😎

    • kyork's avatar
      kyork
      Occasional Contributor

      I have two large test suites with NameMaping so merging will be an issue.  I guess best thing to do is to re-record unfortunately.

    • MW_Didata's avatar
      MW_Didata
      Super Contributor

      You could share the Namemapping over multiple projects, this way any function scripts you create can be used in any project.

      1 downside is that the namemapping gets rather large.

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    In TestComplete you can share KeywordTests scripts among projects by using “Add Existing Item” or Copy and Paste individual operations between projects scripts. However, all script operations reference the project NameMapping, and each project can only have a single NameMapping file. One work around is to merge projects NameMapping and it comes with an expensive cost of planning, solving conflicts, updating references, and maintaining changes.

    If this resolves your scenario, marking it as the solution helps future readers find it quickly.

     

    • kyork's avatar
      kyork
      Occasional Contributor

      I have two large test suites with NameMaping so merging will be an issue.  I guess best thing to do is to re-record unfortunately.