-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContentFind.txt
17 lines (15 loc) · 807 Bytes
/
ContentFind.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
* Search in Json output per specific properties and retrieve
* relevant content with totals
*/
def jsonparser = new groovy.json.JsonSlurper()
// Optional predefined array of properties..
def contentvalues = ['SubArea', 'Entity','TextEntryHTML']
jsonresult = testRunner.testCase.getTestStepByName("<Enter_Test_Step_Name_Here>").getPropertyValue("response")
jsonOutput = jsonparser.parseText(jsonresult)
def objout = jsonOutput.Entity.findAll{ it == "Addresses" }
def contentout = jsonOutput.TextEntryHTML.findAll{ it.contains("Addr") }
objout.each{ obj -> log.info("JSON data:" +obj) }
contentout.each{ contentobj -> log.info("Corresp. Html content:"+contentobj) }
log.info("Total of records: ${objout.size()}".toUpperCase())
log.info("Total of corresp. content: ${contentout.size()}".toUpperCase())