cancel
Showing results for 
Search instead for 
Did you mean: 

sink issue

Highlighted
Contributor

sink issue

Hi,

 

I use below script to sink promotions data in a excel sheet,script is working fine .my question is -1)if Column-"isGlobal "=true for any id then I got results as-true but if "isGlobal" =false then that data not displayed in the results,how to fix this ?

2)Also I want to highlight all my columns name in bold or in different colour so that anyone can easly identify, how to do this part ?

attached my request and response for reference.In my response i got 2 id-537 and 518.for 537-isGlobal=true and 518-isGlobal=False

script details:-

def json = new groovy.json.JsonSlurper().parseText(context.response)
def promotions = json.personalizedOffers*.validCoupon.promotion
//You may add more columns if needed
def columns = ['id','isGlobal', 'categoryType' ]
def sb = new StringBuffer()
sb.append(columns . join(' , ')).append('\n')
def buildPromotionData = { promotion ->
columns.eachWithIndex { key, index ->
promotion[key] ? sb.append(promotion[key]) : sb.append('')
(index+1 != columns.size()) ? sb.append(' , ') : sb.append('\n')
}
}

promotions.each { buildPromotionData(it) }
log.info sb.toString()
testRunner.testCase.getTestStepByName("DataSink").setPropertyValue("promotions", sb.toString())

1 REPLY 1
Highlighted
Community Manager

Re: sink issue

@Community,

 

What can we suggest?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors