Kathryn_O_Malle
15 years agoContributor
Ability to use more than just Strings in properties
Hi there,
As I currently understand things it is only possible to store Strings within Properties. It would be rather helpful if this capability could be expanded to support other Groovy types as well.
An example of the issue we've hit is contained in my support posting entitled "Passing groovy 'lists' via testcase properties...". I've included a copy of it as an example and for reference below.
Kind regards
Adam Hall
[From the Pro Support Forum]
As I currently understand things it is only possible to store Strings within Properties. It would be rather helpful if this capability could be expanded to support other Groovy types as well.
An example of the issue we've hit is contained in my support posting entitled "Passing groovy 'lists' via testcase properties...". I've included a copy of it as an example and for reference below.
Kind regards
Adam Hall
[From the Pro Support Forum]
Passing groovy 'lists' via testcase properties...
Hi,
I am trying to work out how I can create a groovy list and then pass it between testcases using a testcase property. I can create the list happily in a groovy script step but I hit a problem when:
a) I try and store the groovy list in a testcase property
b) I try and retrieve the stored groovy list from a testcase property
The groovy script snippet below helps illustrate it:
[NB: testcase containing this groovy script step has a property called 'idList']def initIdList = [1,2,3]
log.info("...initIdList = "+initIdList)
testRunner.testCase.setPropertyValue("idList", (String)initIdList)
def postIdList = context.expand( '$(#TestCase#idList)' )
log.info("...postIdList = "+postIdList)
log.info(...size of postIdList = "+postIdList.size())
Current Issues:
(1) Having to use '(String)' when storing the list in a testcase property - script step won't currently run without it
(2) When I extract the list out from the testcase property I've lost the contents of the list and instead get a two character array of '[]'
Thanks in advance for any help to sort this one out...