Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // Save common tests in a global variable
  2. postman.setGlobalVariable("commonTests", () => {
  3. // The Content-Type must be JSON
  4. tests["Content-Type header is set"] = postman.getResponseHeader("Content-Type") === "application/json";
  5.  
  6. // The response time must be less than 500 milliseconds
  7. tests["Response time is acceptable"] = responseTime < 500;
  8.  
  9. // The response body must include an "id" property
  10. var data = JSON.parse(responseBody);
  11. tests["Response has an ID"] = data.id !== undefined;
  12. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement