Skip to content

Instantly share code, notes, and snippets.

@jalallinux
Last active March 28, 2022 06:29
Show Gist options
  • Save jalallinux/6b8bf5e37c8bff0a1dcc82d1df3133ac to your computer and use it in GitHub Desktop.
Save jalallinux/6b8bf5e37c8bff0a1dcc82d1df3133ac to your computer and use it in GitHub Desktop.
Postman: Performance Test
pm.test("Successful request", function () {
pm.expect(pm.response.code).to.be.oneOf([200, 201, 202]);
});
pm.test("Response time is less than 217ms.", function () {
pm.expect(pm.response.responseTime).to.be.below(217);
});
pm.test("Response time is less than 317ms", function () {
pm.expect(pm.response.responseTime).to.be.below(317);
});
pm.test("Response time is less than 871ms", function () {
pm.expect(pm.response.responseTime).to.be.below(871);
});
pm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Body has code", function () {
pm.expect(pm.response.text()).to.include("code");
});
pm.test("Body has message", function () {
pm.expect(pm.response.text()).to.include("message");
});
@jalallinux
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment