Postman
Last updated
Was this helpful?
Last updated
Was this helpful?
?KEY=VALUE
:userid
Basic test structure
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
Response assertions
pm.response.to.have.status(200);
pm.expect(pm.response.responseTime).to.be.below(200);
pm.response.to.have.header(”X-Cache");
pm.response.to.have.header(”X-Cache", “HIT”);
pm.expect(pm.cookies.has("sessionId")).to.be.true;
pm.expect(pm.cookies.get("sessionId")).to.equal("abcb9s");
pm.response.to.have.body( "OK");
pm.expect(pm.response.text()).to.include("Order placed.");
Variables
pm.globals.set("varName", "VALUE");
pm.globals.get("varName");
pm.globals.unset("varName");
pm.globals.clear();
pm.environment.set("varName", "VALUE");
pm.environment.get("varName");
pm.environment.unset("varName");
pm.environment.clear()
pm.variables.get("varName")
Create a trello board
Create two lists TODO and DONE
Create a new card inside TODO
Move the card to DONE
Delete the board
{{ENVIRONMENT_VARIABLES}} -> Use to easy switch environment. Allways is used before Global Variables
{{GLOBAL_VARIABLES}} -> The same like Environment but it's not easy to switch. And Environment variables has bigger priority.
console.log(response.prefs);
and click Console to see it.
GET
https://api.github.com/user/repos
1. Authorization > Type - Basic Auth > Username/Password to GitHub 2. Send Request
string
POST
https://api.github.com/user/repos
description
string
"This is a test repository created by Postman"
name
string
"Test-Repository"
GET
https://api.github.com/repos/:owner/:repo
repo
string
Test-Repository
owner
string
testerBartek
POST
https://api.github.com/repos/:{owner}/:{repo}/issues
{repo}
string
Test-Repository
{owner}
string
testerBartek
body
string
"This issue has been automatically created by Postman"
title
string
"Found a bug"
GET
https://api.github.com/repos/:{owner}/:{repo}/issues/:{issue_number}
{issue_number}
string
1
{repo}
string
Test-Repository
{owner}
string
testerBartek
DELETE
https://api.github.com/repos/:{owner}/:{repo}
{repo}
string
Test-Repository
{owner}
string
testerBartek
GET
https://api.github.com/repos/:{owner}/:{repo}
{repo}
string
Test-Repository
{owner}
string
testerBartek