Forum Discussion

Yusufm87's avatar
Yusufm87
Contributor
6 years ago

Where to write the Utility scripts to accept the command line arguments

There is a script available to accept additional command line arguments provided by the user. I am not sure where to add that script in my Project. Is it to be added in a specific file or a separate section is there for such Utility functions?

 

The Utility script is available at this location: 

https://support.smartbear.com/viewarticle/9021/

 

 

Thanks,

Yusuf

2 Replies

  • I would try putting it in the "OnStartTest" event first.

     

    Here's a screen shot of a function that runs when the application starts.

     

    OnStart

    It specifically says that it will run first when you run it from CLI so it should work.

     

     

     

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You add it as a script routine in a script unit in TestComplete.  There's no specific "utility" section of TestComplete.  

    The script as presented in that article simply demonstrates how to use the BuiltIn.ParamStr and BuiltIn.ParamCount methods of TestComplete to find and parse out values.  So, if you need to obtain a commandline parameter passed to TestComplete, you would adapt that script to find that parameter and value and then pass it along to whatever variable, method, or test that needs that value.