Ask a Question

Is it possible to run Test Item with Parameters from command line (TestExecute)

Frequent Contributor

Is it possible to run Test Item with Parameters from command line (TestExecute)

My Test-Item has 3 parameters which I can set in the Test Item Overview menue in TestComplete, but can I alter them from the command line?


What I want to do in particular is, I start TestExecute from jenkins, which runs a specific Test-Item. In the jenkins job I have configured the 3 parameters as Text Parameter, but now I dont know how to actually get those parameters into the test.


I know that I can use additional parameters in jenkins for a TestRun which I can read within the Test - but that is not what I need here. I need to start the Test Item with the parameters.


likes something /projectitem:Test(system,timezone1,timezone2)

Community Hero

Not specifically the way you are wanting, but you can write something to figure out what command line parameters Test Execute is launched with:


function CommandLineArgs()
  var i;
  var nArgs = BuiltIn.ParamCount();
  Log.Message("Total number of command-line arguments: " + nArgs);
  Log.Message("The fully-qualified name of the TestComplete executable: " + BuiltIn.ParamStr(0));

  for (i = 1; i <= nArgs ; i++)
    Log.Message("Arg " + i + ": " + BuiltIn.ParamStr(i));

I don't really like this method myself, so what we do is create a text file with a json string in it to configure environments.


In jenkins you can echo the string to your workspace root with a windows batch command:


echo { "param1" : "%<jenkinsParam1%>, "param2" : "%<jenkinsParam2%> "} > envConfig.json

Then use an on start test event handler to read that info in and parse it to and object. 


JSON.parse(aqFile.ReadWholeTextFile(filePath, aqFile.ctUTF8));


Set that to a project variable and then you can call properties off of the object like you would anything else.


Either way works, I find there are is a lot more room for configuration with the config file approach though and is much easier to maintain / extend. 


Click the Accept as Solution button if my answer has helped
Valued Contributor

There is another way to achieve what you want, except for parsing command line.

Could you please be more specific?

Showing results for 
Search instead for 
Did you mean: