Skip to content
Advertisement

Getting the value from the response element using GPath and Rest Assured

I want to get the value of status from my response. So that i can assert it. I’m using rest assured with java & serenity BDD.

Response

JavaScript

So, here the event id (66e326db-fbfb-4f6e-9d2b-9425e7test5) is dynamic, which means for each run this UUID will get change.

Code

JavaScript

When i run this, i’m getting Unrecognized Exception from serenity BDD. I think, that there is some issue in traversing in JSON.
Can someone please help me on getting the value of status here? So in this case, i’m looking for BOOKING_OPEN

Advertisement

Answer

I think you should store UUID as a variable, and change your locator from your response.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement