[ws] Verify Element Property when property appear multiple times

Newb here.

Testing a GET request that lists the uploaded images for a user.

Looking to verify value : “available” with locator: “status”. However, multiple occurrences of “status”: “available” are in my response and therefore, my test is failing with the error:

“Expected element property value ‘available’ is not equal with actual property value ‘[available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available]’”

I really don’t care how many available values are there. I just want to know that at least 1 shows up. Am I using the wrong webservice keyword?

2019-03-18_16h36_21|690x370

Hi ginny

It might help if you post a bit more info. Have a read of this for some clues:

I’d love to provide some more info if anyone can tell me what they’re looking for. the error message is in its entirety.

Its a REST api, so now web interface to go on.

here’s the console log :
Reason:e[0;39m
e[31mcom.kms.katalon.core.exception.StepFailedException: Expected element property value ‘available’ is not equal with actual property value '[available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available, available]'e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:37)e[0;39m
e[31m at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword$_verifyElementPropertyValue_closure1.doCall(VerifyElementPropertyValueKeyword.groovy:56)e[0;39m
e[31m at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword$_verifyElementPropertyValue_closure1.call(VerifyElementPropertyValueKeyword.groovy)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:66)e[0;39m
e[31m at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword.verifyElementPropertyValue(VerifyElementPropertyValueKeyword.groovy:48)e[0;39m
e[31m at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword.execute(VerifyElementPropertyValueKeyword.groovy:43)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)e[0;39m
e[31m at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.verifyElementPropertyValue(WSBuiltInKeywords.groovy:123)e[0;39m
e[31m at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords$verifyElementPropertyValue$1.call(Unknown Source)e[0;39m
e[31m at List Images (Not Specified) Test Case.run(List Images (Not Specified) Test Case:22)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:331)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)e[0;39m
e[31m at TempTestCase1552934991504.run(TempTestCase1552934991504.groovy:21)e[0;39m
2019-03-18 14:49:57.223 e[34mINFO e[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[39mEND Test Cases/List Images Test Cases/List Images (Not Specified) Test Casee[0;39m

This is the first part of the response i’m testing:

[
{
“id”:“f51fcf56803f7260aa4f88beded66a71”,
“userId”:“d4b7e47052”,
“status”:“available”,
“metadata”:{
“associations”:[
{
“reason”:“Disneyland is the greatest place on earth!”,
“type”:“url”,
“url”:“https://disneyland.disney.go.com/
}],
“location”:{
“gps”:{
“latitude”:{
“units”:“degrees”,
“value”:33.812101
},
“longitude”:{
“units”:“degrees”,
“value”:-117.918975
}
},
“name”:“Disneyland Park, Anaheim, CA, USA”
},
“metadata”:{
“animal”:“dog”
},
“name”:“Rover being funny!”,
“origin”:{
“id”:“AA5634B2-387A-415E-AB32-166C9EDAC32D”,
“name”:“com.apple.HealthKit”,
“type”:“service”
}
},
“contentIntent”:“alternate”,
“contentAttributes”:{
“digestMD5”:“LIRZqi9XBWBdiBHp4SsR9w==”,
“mediaType”:“image/jpeg”,
“width”:15000,
“height”:15000,
“size”:5037358,
“createdTime”:“2019-03-18T14:06:05.462Z”,
“modifiedTime”:“2019-03-18T14:06:05.462Z”
},
“createdTime”:“2019-03-18T14:06:01.737Z”,
“modifiedTime”:“2019-03-18T14:06:05.462Z”,
“revision”:1
},
{
“id”:“6d5948fbfc30deaa33d545cc14584443”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“original”,
“contentAttributes”:{
“digestMD5”:“AW/+m9Eyr488zzdJrolraw==”,
“mediaType”:“image/png”,
“width”:10000,
“height”:10000,
“size”:1774441,
“createdTime”:“2019-03-18T04:08:27.367Z”,
“modifiedTime”:“2019-03-18T04:08:27.367Z”
},
“createdTime”:“2019-03-18T04:08:25.611Z”,
“modifiedTime”:“2019-03-18T04:08:27.367Z”,
“revision”:1
},
{
“id”:“2f202d9075763c57b5eede2ff905cbb2”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“alternate”,
“contentAttributes”:{
“digestMD5”:“Zv1A3k98mEk1tgy9vkwqsg==”,
“mediaType”:“image/jpeg”,
“width”:10000,
“height”:10000,
“size”:1756798,
“createdTime”:“2019-03-18T03:59:16.584Z”,
“modifiedTime”:“2019-03-18T03:59:16.584Z”
},
“createdTime”:“2019-03-18T03:59:14.785Z”,
“modifiedTime”:“2019-03-18T03:59:16.584Z”,
“revision”:1
},
{
“id”:“d6b94b1a8a85961f777c9f1f83b44d00”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“original”,
“contentAttributes”:{
“digestMD5”:“AW/+m9Eyr488zzdJrolraw==”,
“mediaType”:“image/png”,
“width”:10000,
“height”:10000,
“size”:1774441,
“createdTime”:“2019-03-17T06:36:35.304Z”,
“modifiedTime”:“2019-03-17T06:36:35.304Z”
},
“createdTime”:“2019-03-17T06:36:32.329Z”,
“modifiedTime”:“2019-03-17T06:36:35.304Z”,
“revision”:1
},
{
“id”:“41c2f259151041aaac2d31f1dc9a5ca0”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“alternate”,
“contentAttributes”:{
“digestMD5”:“AW/+m9Eyr488zzdJrolraw==”,
“mediaType”:“image/png”,
“width”:10000,
“height”:10000,
“size”:1774441,
“createdTime”:“2019-03-17T06:35:22.791Z”,
“modifiedTime”:“2019-03-17T06:35:22.791Z”
},
“createdTime”:“2019-03-17T06:35:19.55Z”,
“modifiedTime”:“2019-03-17T06:35:22.791Z”,
“revision”:1
},
{
“id”:“35784df2f758bd6e335dcd553d879754”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“original”,
“contentAttributes”:{
“digestMD5”:“AW/+m9Eyr488zzdJrolraw==”,
“mediaType”:“image/png”,
“width”:10000,
“height”:10000,
“size”:1774441,
“createdTime”:“2019-03-17T06:34:55.238Z”,
“modifiedTime”:“2019-03-17T06:34:55.238Z”
},
“createdTime”:“2019-03-17T06:34:51.955Z”,
“modifiedTime”:“2019-03-17T06:34:55.238Z”,
“revision”:1
},
{
“id”:“a6f82caf5a9b6af9b2dbb70cf61b2d86”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“original”,
“contentAttributes”:{
“digestMD5”:“2BuzUPW5t9jRZtONlg0vcg==”,
“mediaType”:“image/jpeg”,
“width”:10000,
“height”:10000,
“size”:1749440,
“createdTime”:“2019-03-17T06:33:37.237Z”,
“modifiedTime”:“2019-03-17T06:33:37.237Z”
},
“createdTime”:“2019-03-17T06:33:34.633Z”,
“modifiedTime”:“2019-03-17T06:33:37.237Z”,
“revision”:1
},
{
“id”:“0042d943cd9d20bc7d6fbd9ee2939d1b”,
“userId”:“d4b7e47052”,
“status”:“available”,
“contentIntent”:“alternate”,
“contentAttributes”:{
“digestMD5”:“2BuzUPW5t9jRZtONlg0vcg==”,
“mediaType”:“image/jpeg”,
“width”:10000,
“height”:10000,
“size”:1749440,
“createdTime”:“2019-03-17T06:30:14.142Z”,
“modifiedTime”:“2019-03-17T06:30:14.142Z”
},
“createdTime”:“2019-03-17T06:30:11.436Z”,
“modifiedTime”:“2019-03-17T06:30:14.142Z”,
“revision”:1
},
{
…the whole thing is quite long and just repeats itself with different images so i don’t think its necessary to paste the whole thing.

I will not be able to give a login or authentication token for security purposes.

Hope this helps. If there’s specific information needed please let me know. Pretty new to Katalon and automation in general so they’r might be something i didn’t think of. Thanks in advance!

Hi,

I guess that you are extracting all status nodes (list) and verifying it to String "available"
do some tricks to your REST response code, maybe response[0] has correct value to verify

oh, That’s a good thought @Timo_Kuisma! Let me see if i can try that!