Forum Discussion
jsreesoap
12 years agoContributor
Hi
It is writing the values now (Thanks to Jeshtha) but my problem is I need to pick up the value from the same location like 'def responseAsXml1 = context.expand( '${GET Restrictions on an Account#ResponseAsXml#//Response[1]/e[1]/accountRestrictionId[1]}' )' and write it to a dynamically created property. In each iteration the value changes. In each iteration I am feeding a different account number. So first time it picks up the restriction id and writes it to RestrictionIdi1 but when it runs second time (x==1) it is replacing the RestrictionIdi1 with the latest (restriction id of the second account number) which in my opinion should not as it is not executing condition x==0. Attached is my project file, I removed authorization step for security reasons.
Here is my code:
for (x in 0..1)
{
if (x==0)
{
def responseAsXml0 = context.expand( '${GET Restrictions on an Account#ResponseAsXml#//Response[1]/e[1]/accountRestrictionId[1]}' )
testRunner.testCase.setPropertyValue("RestrictionIndi" +[x],responseAsXml0)
}
if (x==1)
{
def responseAsXml1 = context.expand( '${GET Restrictions on an Account#ResponseAsXml#//Response[1]/e[1]/accountRestrictionId[1]}' )
testRunner.testCase.setPropertyValue("RestrictionIndi" +[x],responseAsXml1)
}
}
Thanks
It is writing the values now (Thanks to Jeshtha) but my problem is I need to pick up the value from the same location like 'def responseAsXml1 = context.expand( '${GET Restrictions on an Account#ResponseAsXml#//Response[1]/e[1]/accountRestrictionId[1]}' )' and write it to a dynamically created property. In each iteration the value changes. In each iteration I am feeding a different account number. So first time it picks up the restriction id and writes it to RestrictionIdi1 but when it runs second time (x==1) it is replacing the RestrictionIdi1 with the latest (restriction id of the second account number) which in my opinion should not as it is not executing condition x==0. Attached is my project file, I removed authorization step for security reasons.
Here is my code:
for (x in 0..1)
{
if (x==0)
{
def responseAsXml0 = context.expand( '${GET Restrictions on an Account#ResponseAsXml#//Response[1]/e[1]/accountRestrictionId[1]}' )
testRunner.testCase.setPropertyValue("RestrictionIndi" +[x],responseAsXml0)
}
if (x==1)
{
def responseAsXml1 = context.expand( '${GET Restrictions on an Account#ResponseAsXml#//Response[1]/e[1]/accountRestrictionId[1]}' )
testRunner.testCase.setPropertyValue("RestrictionIndi" +[x],responseAsXml1)
}
}
Thanks