Learn how to verify fields of a response body in this video.
- Given this response body from our request … to get the product with ID2. … Let's now write assertions for each … of the fields of the body. … As you can see on line 25 we are already using … the assert that method from REST Assured … to verify the status code on line 26. … We can chain additional assertions to this call. … For example, I can say .body … and specify any of the fields from the body … and verify their values. … So as we can see here the first field is ID. … So I would place ID here within quotes … and then I need to specify a matcher to match the value. … Let's talk a little bit more about matchers. … The REST Assured library contains Hamcrest matchers. … This is a class of functions that allow you to compare … your expected result with the actual one. … And as you can see there are many different matcher methods … that you can choose from. … The one you choose depends on what you need to verify … and how strictly you'd like to verify it. … For example, if we just wanted to make sure an ID …
Skill Level Intermediate
API setup3m 46s
1. Getting Started with REST Assured
REST Assured testing library3m 29s
2. Making API Requests
3. Validating API Responses
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.