sn1693
sn1693

Reputation: 271

Karate - actual value is not a string

I am checking for an 'OK' parameter in response but getting above mentioned error. The same code was working with my previous karate version, now I am using 0.9.0 - This might be some issue with my coding, can't figure out.

Response:

"testResponse": {
    "planSummary": {
      "includedServicesList": [
          {
            "some elements goes here": "test"
          }
        ],
      "status": {
        "statusCd": "200",
        "statusTxt": "OK"
      }
   }
}

My Feature File Code:

When method get
Then status 200
Then match response contains 'OK'

I get expected: 'OK', reason: actual value is not a string error.

I tried with Then match response contains {statusTxt: 'OK'} as well.

Upvotes: 2

Views: 2045

Answers (1)

Babu Sekaran
Babu Sekaran

Reputation: 4239

You can try this,

* match response.testResponse.planSummary.status contains {'statusTxt' : 'OK'}

OR

* match response.testResponse.planSummary.status.statusTxt == 'OK' 

Upvotes: 2

Related Questions