how to store data source values in array
How to store the data source output in an array without the values being overwritten.
My XML datasource results in 5 datas - price_discountCode,price_taxWaived,comm_notifEmail,price_creditdelay,comm_smsNumber
I try to store these 5 values in an array using groovy. My Groovy to store the data is as below:
def DSrowcount = testRunner.testCase.testSteps["XML_DataSource_AttributeName"].rowCount
log.info "Total rows of DS output:: " +DSrowcount
def ds = testRunner.testCase.getTestStepByName('XML_DataSource_AttributeName')
def attributename, attributeid, attributevalue = ""
def WS_AttributeNameList = []
def Namelist=[]
def WS_AttributeIdList = []
def WS_AttributeValueList = []
for (row in 1..DSrowcount)
{
attributename = ds.getPropertyValue('attributeName')
WS_AttributeNameList.add(attributename )
}
log.info "AttributeNames are: " +WS_AttributeNameList
Expected array output:
[price_discountCode, price_taxWaived, comm_notifEmail, price_creditdelay, comm_smsNumber]
Actual array output:
[comm_smsNumber, comm_smsNumber, comm_smsNumber, comm_smsNumber, comm_smsNumber]
Please help to resolve.