Passing Test Parameters via Command Line won't work
Hi,
I'm trying to launch test complete and pass a parameter via command line but, following the instructions from here - https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/custom-parameters.html it fails
This is my command line - TestComplete.exe "C:\Testcomplete\DA_Automation_Test_Framework.pjs" /r /p:PlayGroundProject /u:Unit1 /rt:Main /LatestSprintVersionNumber=ppp
I also tried /arg: (As I work with sessioncreator), I tried pv and psv. nothing is working.
In TC report I can see all the parameters except the one I want which is /LatestSprintVersionNumber=ppp
We are triggering TE to execute the code via jenkins file and I'm not sure what should I put in the command line. the parameter I want to transfer is being retrieved by jenkins, I want to take it and pass it to the executable code via the command line.
If anyone knows why please let me know?
Cheers,
Ofer
Hi,
Just for the sake of anyone else get into this problem, here is the solution:
def processCommandLineArgument(VersionFromTheApp):
#iterate through all parameters sent via command line set in Jenkins file
for i in range (0, BuiltIn.ParamCount()):
#verify any of tha parameters contain a string called LatestSprintVersionNumber
if "LatestSprintVersionNumber" in aqConvert.VarToStr(BuiltIn.ParamStr(i)):
#split the /LatestSprintVersionNumber=x.x.xxxx.xx parameter into 2 bits ('/' 'and LatestSprintVersionNumber=x.x.xxxx.xx')
items = aqConvert.VarToStr(BuiltIn.ParamStr(i)).split("/")
#split the LatestSprintVersionNumber=x.x.xxxx.xx parameter into 2 bits ('LatestSprintVersionNumber and 'x.x.xxxx.xx')
items = aqConvert.VarToStr(items[1]).split("=")
#check if the first item in position [0] in items array equals to 'LatestSprintVersionNumber'
if aqConvert.VarToStr(items[0]) == "LatestSprintVersionNumber":
#check if the value appears in the app in the help-->about window equals to the second item in position [1] in items array
if VersionFromTheApp == aqConvert.VarToStr(items[1]):
Log.Message("The latest sprint version passed via the command line is " + aqConvert.VarToStr(items[1]))
Log.Message("The installed version is " + VersionFromTheApp)
Log.Message("Both, latest sprint build version and the installed one are the same")
else:
Log.Message("The latest sprint version passed via the command line is " + aqConvert.VarToStr(items[1]))
Log.Message("The installed version is " + VersionFromTheApp)
Log.Message("The latest sprint build version and the installed one are not the same")