API Contract Testing

Hello, how are you guys ?

I was wondering, if there’s some method in katalon that allow us to validate just the api contract (Something like: iterates the response and check if the properties that i set are returned in request response [neither more nor less])

Currently, i’m using the containsString method to do the job, but i’m almost sure that there’s a better way to do this.
Has anyone ever had to do something like this ?

Thanks in advance!

1 Like

Given the service contract should be well defined, for a given request, the response should be known and predictable. If you want to verify the entire response, then yes, I would certainly iterate the response elements and compare values.

What did you have in mind as an alternative?

BTW, personally, I would try to be more exact than containsString. I’d also likely run the request in JavaScript and examine the response in JavaScript, too (but that’s just me).

also you can try to use https://json-schema.org to check if response is valid against defined schema

5 Likes

Good point, Andrej. Upvoted.

Thanks for the advices guys, i’m studying the json schema and i’ll try to implement this on my script.

Thanks!

Hi Thomas, could you explain the need of using javascript to request and verify response, perhaps giving us a short example?

Any alternative inside the Katalon tool?..

Alternative to… what?

To perform API contract Testing

Has been already answered. Does json schema validation works for you?

Sorry, Can you give a sample code here to perform contract testing using Katalon?

can you please add more context on your understanding about ‘contract testing’?
what is the AUT?
and what is the testing scope?

I have web app which use multiple microservices , multiple database. Need to validate the API Contract testing which used in different microservices.
i.e. request and response and validate JSON schema.

as i said, it has been already answered.
see related topics, choose what solution suits to you best (everit, jackson, justify or anything else):

http://forum.katalon.com/search?q=json%20schema%20validation