课程: Java: Automated API Testing with REST Assured
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Verify API response - Java教程
课程: Java: Automated API Testing with REST Assured
Solution: Verify API response
(upbeat music) - [Instructor] How'd you do? Let's walk through the solution of verifying the response to this get product request. First, we create a new method. And inside of this method, we declare the endpoint, which is read one. And then we say, given the ID is 18, when we make a get request to this read one endpoint, then we can assert that. And now we want to assert the three parts of the response, starting with the status code, which should be 200, meaning the get request was successful. Next, we want to make sure that the data was returned to us in JSON format. So we verify that the content type header has a value of application JSON. Then the final part of the response is the body. And the challenge was to verify each of its fields. These can be verified in any order, as long as there's an assertion for each one. The ID should be 18. The name should be equal to multivitamins, 90 capsules. And if you use the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
Anatomy of a response2 分钟 1 秒
-
(已锁定)
Verifying status code of a response2 分钟 20 秒
-
(已锁定)
Accessing response body1 分钟 35 秒
-
(已锁定)
Verifying fields of response5 分钟 50 秒
-
(已锁定)
Verifying complex response bodies7 分钟 37 秒
-
(已锁定)
Verifying response header2 分钟 52 秒
-
(已锁定)
Deserializing response body7 分钟 54 秒
-
(已锁定)
Challenge: Verify API response33 秒
-
(已锁定)
Solution: Verify API response1 分钟 55 秒
-
(已锁定)