Testops is not showing array length tests

How to verify the length of array of on testops same is printing on console. But not on testops

Console: showing 500

Katalon testops

  1. How to only show the Verification checks
  2. for print command what assertion do i need add in my test (highlighted) where was expecting the array length to print.

Hi gsp,

Println method wil print on console but not write it to log file. So you can try KeywordUtil.logInfo(‘message’) keyword, which will print on console as well as write down to log file and upload to TestOps.

How to do that for this?
you can see verify responseStatus does opens and showed passed, but not the assert. How to verify these values and showed passed in testsuites and test ops too?
image

code is

WS.verifyResponseStatusCode(response, 200)
def responseText = response.getResponseBodyContent()
def jsonSlurper = new JsonSlurper()
def json = jsonSlurper.parseText(responseText)
assert json.users[0].firstName == 'Varsha'
assert json.users[0].lastName == 'Gupta'

WS.verifyElementPropertyValue(json, 'users[0].lastName', 'Gupta') <--This is failing

Hi @Thong

i am using this code and it showing null, instead of 500

def lset = println(results.size())
WS.verifyElementsCount(response, 'lset', 500)
KeywordUtil.logInfo(lset)
2020-11-06 14:46:52.976 DEBUG testcase.Length                        - 11: lset = println(results.size())
500
2020-11-06 14:46:52.980 DEBUG testcase.Length                        - 12: verifyElementsCount(response, "lset", 500)
2020-11-06 14:46:53.071 DEBUG testcase.Length                        - 13: logInfo(lset)
2020-11-06 14:46:53.078 INFO  com.kms.katalon.core.util.KeywordUtil    - null

def lset = results.size()
KeywordUtil.logInfo(lset)

You can try this.

@Thong showing error the value is numeric

def Itemfld = parsedjson.itemization.size()
println("The total Itemization fields are:" + Itemfld)
KeywordUtil.logInfo(Itemfld)

logInfo(Itemfld)

No signature of method: static com.kms.katalon.core.util.KeywordUtil.logInfo() is applicable for argument types: (java.lang.Integer) values: [35]
Possible solutions: logInfo(java.lang.String), notify()

@Thong any help in this pls

Try Groovy’s String interplation https://groovy-lang.org/syntax.html#_string_interpolation

KeywordUtil.logInfo("${Itemfld}")

@gsp
the loginfo method from KeywordUtil class expect a string as argument.
see: https://docs.katalon.com/javadoc/index.html

you are passing an integer to it through your variable, therefore the error.

follow @kazurayam advice or use any other java or groovy method to convert integer to string (google is your friend here)