Forum Discussion

Philip_Baird's avatar
Philip_Baird
Community Hero
12 years ago

Scripting "Add | Existing Item..." for Script Units


Hi, I have a Project named Framework that contains common utility code for use by other Projects.


 


I have about half a dozen Projects that reference the Script Units in this Framework Project via "Add | Existing Item..."


 


On occasion, I find it necessary to add new Script Units to the Framework Project.


 


Instead of manually going through each of the Projects that reference the Framework Script Units and manually performing the "Add | Existing Item...", is it possible to script the "Add | Existing Item..." so I can run, say, a batch file that will automatically add a reference to the Script Unit I have added to Framework Project to each of the Projects that utilise the Framework code?


 


Regards,


Phil Baird

2 Replies

  • Hello Phil,



    That's the same dilemma my team have previously encountered in our framework.



    2 options you can do:


    1. Make it a team process that whenever a new unit script is added in the project of the utility framework, it should also be added in the calling projects.


    2. Instead of having a utility framework project, write your custom methods in a plugin format so you can install it to your team member's TestComplete instance as a Script Extention.


    *** For my team, we did both option as Option 2 would contain thousands of lines of code while Option 1 will give more flexibility during updating of library scripts

  • Hi Paul, I have investigated Script Extentions many times but keep bumping into the following caveat:


     


    "Unlike TestComplete projects, references between script files in a script extension package are not allowed. Called routines must be located in the same script file as the caller ones."


     


    Our framework is based around JScript objects and inheritance and this kills it for us, and, to be honest, anything we have that is a candiate for a Script Extention ends up in a .Net helper library accessed via the CLR Bridge as it is just so much better.


     


    Anyway, I've done some investigation around the XML files Test Complete uses and I am pretty sure I can write a simple app to do what I need, I was just hoping I wouldn't be necessary.


     


    Phil