Kathryn_O_Malle
14 years agoContributor
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']
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...
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...