Pm.expect(pm.response.json().id).to.equal(pm.variables.get("id")) ) Pm.expect(pm.response.json().name).to.equal("Transformers")) We can use the id variable to do that: pm.test("success status", () => pm.response.to.be.success ) Secondly, we know which id to expect this time, so let's verify that id. Because the tests are similar, we can copy the tests from the POST request, then make a few changes.įirstly, we don't need to set the id variable again, so let's not copy that line. Since there's no body for a GET request, let's proceed directly to the Tests tab. Variables, when appearing outside of scripts, are referenced using the double-brace syntax. Thus, the GET request should retrieve the same instance that was created by the POST. ![]() In this URL, we're referencing the id variable that we previously set during the POST request.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |