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())