Forum Discussion

maxqiu's avatar
maxqiu
Occasional Contributor
6 years ago
Solved

Pass TestComplete variable to Jenkins.

I need to pass a temporary variable defined in TestComplete as a parameter in Jenkins., I used the additional command line parameter to make the parameter and it still doesn't wok. It only call the variable in the testcomplete. But I need to call the variable parameter function in the Jenkins. What should I do? 

 

Thanks so much

 

 

  • So, just to be clear... you want something like this:

     

    C:\Program Files (x86)\SmartBear\TestComplete 12\bin\TestComplete.exe "C:\MyProjects\MyProject.pjs" /r /e /myVariable="12345"

    where the value that is in red you want to populate the variable value in TestComplete, yes?

    The answer is----  You can't out of the box.  You need to write code in TestComplete to read the commandline, find the parameter, read it, parse out the value, and assign it to your variable.

    Besides... didn't you just mark this thread as having a solution?  Is it not working?  What are you trying to do that is not covered in the below thread?
    https://community.smartbear.com/t5/TestComplete-General-Discussions/command-line/m-p/168961#M31263

  • As said in the previous thread you have to assign your command line argument value to your Project.Variables.<variableName>, just grabbing the argument does not set the value to anything, you have to this yourself. 

     

    Something like if you're pasing /arg=val for example.

     

    Project.Variables.var1 = BuiltIn.ParamStr(<positionOfArgument>).split("=")[1]

     

2 Replies

  • cunderw's avatar
    cunderw
    Community Hero

    As said in the previous thread you have to assign your command line argument value to your Project.Variables.<variableName>, just grabbing the argument does not set the value to anything, you have to this yourself. 

     

    Something like if you're pasing /arg=val for example.

     

    Project.Variables.var1 = BuiltIn.ParamStr(<positionOfArgument>).split("=")[1]

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    So, just to be clear... you want something like this:

     

    C:\Program Files (x86)\SmartBear\TestComplete 12\bin\TestComplete.exe "C:\MyProjects\MyProject.pjs" /r /e /myVariable="12345"

    where the value that is in red you want to populate the variable value in TestComplete, yes?

    The answer is----  You can't out of the box.  You need to write code in TestComplete to read the commandline, find the parameter, read it, parse out the value, and assign it to your variable.

    Besides... didn't you just mark this thread as having a solution?  Is it not working?  What are you trying to do that is not covered in the below thread?
    https://community.smartbear.com/t5/TestComplete-General-Discussions/command-line/m-p/168961#M31263