1

I can successfully read one field value and match it for a passed validation test

* def query = "select first_name from uds.enrollment where email = '" + randomEmail + "'"
 * def dbresponse = db.readValue(query)
 * print dbresponse
 * match dbresponse == (randomFirstName)

We also store first_name inside a borrower object field in the same DB table.

I can retrieve the whole object here by calling:

 * def query = "select borrower from uds.enrollment where email = '" + randomEmail + "'"
 * def dbresponse = db.readValue(query)
 * print dbresponse

But when I try to match

 * match dbresponse.first_name == (randomFirstName)

It errors with

  match failed: EQUALS
  $ | actual path does not exist (STRING:STRING)
  '#notpresent'
  'Kerrie'

seems like it should just work, but I maybe missing something?

thanks!

mark quinteros
  • 129
  • 1
  • 7
  • apologies for closing this, but read the linked answer - and karate has nothing to do with what you are doing in that `db` object you have. if it is a JSON string, consider converting it to a JSON object in karate and then doing assertions – Peter Thomas Nov 16 '22 at 01:22
  • Hi there. Thanks but the linked answer doesn't have anything to do with my issue above. Ill look into converting it from JSON string to JSON object. Is that in the karate docs? – mark quinteros Nov 16 '22 at 17:10
  • 1
    I think this may give me some guidance thanks https://stackoverflow.com/questions/72406573/karate-convert-json-string-field-to-json-object – mark quinteros Nov 16 '22 at 17:13

0 Answers0