Hi,
Can someone tell me how to pass a list of parameters using runWithNewResults?
I can pass a list of parameters without it like this:
TestcaseName ListofParam
But if I use this:
runWithNewResults TestcaseName ListofParam
or
runWithNewResults TestcaseName {ListofParam}
or
runWithNewResults TestcaseName (ListofParam)
it won’t work.
Thanks,
David
The testCaseName is actually the first parameter to the RunWithNewResults command. Any additional parameters will be passed along to the script that is run. So you need a comma in there:
RunWithNewResults testCaseName,param1,param2
If your parameters are actually in a list, then you can do this:
RunWithNewResults (testCaseName &&& ListOfParam) as parameters
Hi,
I’m still not able to get it to work. I try this:
runWithNewResults (TestcaseName &&& row)
Thu, 3/1/07 12:42:42 PM FAILURE Error Running Script Command runwithnewresults Error - Unable to locate script named: (Testcase1, app1, Data1, Data2, Data3, Data4, Data5)
Execution Time 0:00:05 Main_Test2.script
Hi,
It did work like this:
runWithNewResults TestcaseName, row
but it pass in a list of parameters as one parameter.
In the testscript I was able to get it as a list. Is there any way to create dynamically name variable?
Like this:
params DataList
repeat with each Data in DataList
put counting +1 into counting
put Data into (NewDataVariable & counting)
end repeat
I’m still not able to get it to work. I try this:
runWithNewResults (TestcaseName &&& row)
You left off the magic words " as parameters"! Doing it as you’ve shown above passes a single list as the parameter to the RunWithNewResults command. By specifying “as parameters” the items of the list will be passed as individual parameters.
In the testscript I was able to get it as a list. Is there any way to create dynamically name variable?
Like this:
params DataList
repeat with each Data in DataList
put counting +1 into counting
put Data into (NewDataVariable & counting)
end repeat
Yes, you can, although you shouldn’t really need to. In a situation where you receive a list and want to put the separate values into several variables, the simplest solution is probably this:
put DataList into (var1, var2, var3, var4, var5)
Any additional values in DataList will be ignored, and if there are fewer values in DataList than the number of variables, the remaining variables will be set to empty.
To answer the question you asked, though, you can create dynamically named variables and assign values to them like this:
repeat with each Data in DataList
add 1 to counting
do "put Data into NewDataVariable" & counting
end repeat