Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Writing tests for API requests

pm.test("Request is successful with a status code of 200", function () {
  pm.response.to.have.status(200);
});

pm.test("Check that it returns an array", function () {
  var jsonData = pm.response.json();
  pm.expect(jsonData).to.be.an("array");
});
Source by circleci.com #
 
PREVIOUS NEXT
Tagged: #Writing #tests #API #requests
ADD COMMENT
Topic
Name
6+4 =