Forum Discussion

steve_hall's avatar
steve_hall
Contributor
12 years ago

TestComplete command line, and functions with parameters


Hi All,  


I'm trying to work out how, from the command line I can:


 


Start TC, pointing to suite, project, script, and function, where the function takes a string parameter. 


 


For easy explanation purposes imagine a test function:  


 


function test2(msgtxt)


{


  MessageDlg(msgtxt,0,0,0);




 


I want to be able to do something like:


 


TestComplete.exe mysuite.pjs /r /p:myproject /u:scriptname /rt:test2("Hi Steve!") /exit /ns


 


But this produces 2 TC error dialogs: "The command line is invalid", and then "The command line is invalid. The test cannot be found".


 


PLEASE tell me what I am trying to do CAN be done? If so, how? The only alternative I can think of is setting "Hi Steve" to some temporary system env variable, and getting TC function to pick that sys var up... But that seems rather "over the top" as solutions go?  



Thanks



Steve 


 

  • I think you should create another function that will parse the TestComplete's command line arguments, and you will specify its name in command line along with the desired parameter value using the custom command line argument.

    See example of parsing command line arguments here: TestComplete Command Line (ParamStr, ParamCount functions).
  • Hanya  has the right idea. We use this a lot. You can pass any amount of paramaters you want to Test Complete then use them afterwards in your functions. 
  • I think you should create another function that will parse the TestComplete's command line arguments, and you will specify its name in command line along with the desired parameter value using the custom command line argument.

    See example of parsing command line arguments here: TestComplete Command Line (ParamStr, ParamCount functions).
  • Thanks all - you were spot on - a parser function was exactly what was needed, working (so far) very nicely!



    Thanks!