Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Postman - asserty w automatycznych testach
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Response time is less than 200ms", function () {
pm.expect(pm.response.responseTime).to.be.below(200);
});
pm.test("Return added product data", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.Success).to.eql(true);
pm.expect(jsonData.Value.Id).to.eql(1);
pm.expect(jsonData.Value.Name).to.eql("Name1");
});
pm.test("Return added product data", function () {
pm.response.to.have.body('{"Value":{"Id":1,"Name":"Name1"},"Success":true,"Errors":[]}');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment