Forum Discussion

Ranjana_Lokanat's avatar
Ranjana_Lokanat
New Contributor
11 years ago

Issue with maintenance of reference files

Hi,

I am new to Testcomplete and would like to know a better way to design my project suites.

I have a set of  Helper scripts which have many common functions,

I have many project suites.

Now in each of these project suites, I have different projects and in each project, I have different test scripts , which uses the functions defined in my Helper scripts.



Currently I am doing the following to call the functions

1. Add a reference to the Helper scripts, by RMC on add, then selecting existing item and poiting to the physical location of my helper script.

2. In my test script header entering "//USEUNIT Helperscript"



With this approach we ran into some issue:

1. When some more helper scripts were added, I have to manually go back to each project suite and add the reference.

2. Also modify the test scripts accordingly.



Is there an easier way for me to reference some common functions for all my project suites, where once I make a modification in one location, the rest all get updated, without me having to manually update changes (either addition of new helper scripts/ reduction of helper scripts).



Thanks in advance for all your help.

4 Replies

  • Philip_Baird's avatar
    Philip_Baird
    Community Expert
    Hi Ranjana, it doesn't matter what language your helper Scripts are in, even though Script Extensions must be written in either VBScript or JScript, in terms of execution, they are language independant as per the documentation here.




    "The language you opt for -- VBScript or JScript -- does not affect the range of projects where the extension can be used. Script extensions are language-independent and work equally well in VBScript, JScript, DelphiScript, C++Script and C#Script projects no matter which language was used to create an extension"


     


    Another thing, in terms of C# Script, you should realise that C# Script is NOT C#. C# Script is really just a restricted subset of JScript which excludes the use of dot notation which can be compiled in C# Self-Testing and Connected Applications, as per the documentation here.




    Unless you are planning on using Self-Testing or Connected Applications there really is no point in using C# Script.


     


    Regards,


    Phil Baird




  • Script extensions?



    http://support.smartbear.com/viewarticle/55349/



    I have all the methods my test framework uses, and a few other bits and bobs, added as extension units. Only thing you need to remember is to add them to the install of any new instances of TestComplete you put in place.



    And obviously if you update any of the scripts, you need to update all your installs.



    ** EDIT **



    Sorry. Didn't read to the end. This won't update all your installs if you change one instance. Think direct link to a source controlled project would be the only way of doing that.  Maybe something in here: http://support.smartbear.com/viewarticle/56394/
  • Thank you Colin for your suggestion.



    I looked up the link that you shared and found that script extensions are created in VBScript or JScript.

    Do you know whether we can also use C# to write script extensions as all our helper scripts are coded in C#. ?



    Thanks
  • Maybe create a custom plugin instead?



    http://support.smartbear.com/viewarticle/55440/



    I use VBS so the script extensions were fine for me. Didn't realise only that and Jscript were supported for those.



    ** EDIT **



    Not thinking. That still wouldn't centralise it.



    It is a good thing to share with other TC users or possibly even the TC dev people. Depending what it is your helpers do.