gsp
October 27, 2020, 9:25pm
1
How to verify the length of array of on testops same is printing on console. But not on testops
Console: showing 500
Katalon testops
How to only show the Verification checks
for print command what assertion do i need add in my test (highlighted) where was expecting the array length to print.
Thong
October 28, 2020, 3:42am
2
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.
gsp
November 6, 2020, 8:22pm
3
Thong:
KeywordUtil.logInfo
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?
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
gsp
November 6, 2020, 8:50pm
4
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
gsp
November 11, 2020, 8:40pm
6
@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()
gsp
November 20, 2020, 5:36pm
7
@Thong any help in this pls
Try Groovy’s String interplation https://groovy-lang.org/syntax.html#_string_interpolation
KeywordUtil.logInfo("${Itemfld}")
1 Like
@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)
1 Like