Lesson 1: Requests in Postman
A side project from Bangalore
Postman began as a side project. Its own about page says that Abhinav Asthana set out to build a tool that would make testing APIs simpler. When the tool's use quickly exploded, Abhinav asked two former colleagues, Ankit Sobti and Abhijit Kane, to help create Postman, Inc. The company is now headquartered in San Francisco, and the same page notes that it was founded in Bangalore.
Why it fits here: It answers this topic's question: Postman began as one person's side project, and the company was founded in Bangalore.
Source: About Postman
Topic: Postman's window, in words · history, people
From a Chrome app to Electron
Postman first ran inside Google Chrome, as a Chrome app with a helper extension called Interceptor. In March 2017, Postman's blog urged users to move to its native apps for Mac, Windows and Linux, which run on Electron, because Google had announced the end of Chrome apps on those systems. The native apps could also send headers such as Origin and User-Agent, which the Chrome app could not.
Why it fits here: It explains why Postman's window is a desktop app today: the first Postman lived inside Chrome, and moved to Electron when Chrome apps ended.
Source: Postman blog: Going native
Topic: Postman's window, in words · history, tools
br is a small Swiss bread
The br in Accept-Encoding stands for Brotli, a way of squeezing data that Google introduced in September 2015. Its announcement says that, like Google's earlier Zopfli, it is named after a Swiss bakery product: Brötli means small bread in Swiss German. Google reported 20 to 26 percent better compression than Zopfli, and Brotli became RFC 7932 in July 2016.
Why it fits here: It answers this topic's question: br is Brotli, named after a Swiss German word for a small bread.
Sources: Google Open Source Blog: Introducing Brotli; RFC 7932: Brotli Compressed Data Format
Topic: A request, written down · names, internet
No Host, no answer
Every HTTP/1.1 request must carry a Host header. RFC 9112, of June 2022, says that a client must send one, and that a server must answer 400 Bad Request to a request that lacks it. The reason is in RFC 9110: Host lets one server tell apart the resources of the many host names it serves, so many websites can share one machine.
Why it fits here: It explains one header Newman always adds: an HTTP/1.1 server must refuse a request that comes without Host.
Sources: RFC 9112: HTTP/1.1; RFC 9110: HTTP Semantics
Topic: A request, written down · standards, internet
OpenAPI began as Swagger
A widely used format for describing a whole API is the OpenAPI Specification. Its own FAQ says that it was based on the Swagger 2.0 specification, renamed, which SmartBear Software donated in 2015. In November 2015, SmartBear, Google, IBM, Microsoft, PayPal and five other companies formed the OpenAPI Initiative, an open source project under the Linux Foundation, to look after it.
Why it fits here: It answers this topic's question: the OpenAPI Specification, which began as Swagger, describes a whole API in one file.
Source: OpenAPI Initiative: FAQ
Topic: A first collection · history, standards
Collections as plain text
Not every API client keeps collections the way Postman does. Bruno, an open source tool for exploring and testing APIs, stores each collection directly in a folder on your computer, written in a plain text language of its own called Bru, so that a team can share collections through Git. Its README also promises that Bruno is offline only, with no plans to add cloud sync, ever.
Why it fits here: It shows another way to keep this topic's collections: plain text files in a folder, shared through Git.
Source: Bruno on GitHub
Topic: A first collection · tools
Named after a mail carrier
Newman shares its name with a character in the American comedy Seinfeld: Newman, an employee of the United States Postal Service, and so a postman. In March 2017, someone asked on Newman's GitHub page whether the name was a reference to Seinfeld. A contributor to the project answered on 3 April 2017: Yes, it is.
Why it fits here: It answers this topic's question: Postman's runner is named after Newman, the postal worker in Seinfeld.
Sources: Newman issue 963: Is this a reference to Seinfeld?; Wikipedia: Newman (Seinfeld)
Topic: Running a collection with Newman · names, people
Rewritten as a library first
The Newman you call as a library is not its first design. Newman's migration guide says that version 3.0, published on npm in August 2016, was a complete rewrite from the ground up, written with a library-first mindset. Since then, Newman runs collections with Postman Runtime, to give the same results in the Postman apps and on the command line.
Why it fits here: It explains this topic's library mode: since version 3.0, Newman has been written as a library first.
Sources: Newman's migration guide; The npm registry's record of newman
Topic: Running a collection with Newman · history, tools
From newman -c to newman run
Old tutorials run Newman as newman -c collection.json. Newman's migration guide explains the change: since version 3.0, collection runs happen with the run command, and the -c option was deprecated in favour of passing the file's path alone. Version 4.0, published in August 2018, then dropped all the deprecated options of version 2, so the old form no longer works.
Why it fits here: It helps with this topic's command: a tutorial that shows newman -c was written before version 3.0.
Sources: Newman's migration guide; The npm registry's record of newman
Topic: Newman on the command line · history, mistakes
Who named continuous integration
Build servers that run every change through its tests practise continuous integration. Martin Fowler's article on it, in its version of 18 January 2024, says the practice was developed by Kent Beck as part of Extreme Programming in the 1990s. Some people credit Grady Booch with coining the term, but Fowler notes that Booch used the phrase only as an offhand description, in a single sentence of a book.
Why it fits here: It answers this topic's question: Kent Beck developed the practice, and Grady Booch used the phrase once, in passing.
Source: Martin Fowler: Continuous Integration
Topic: Newman on the command line · history, people
Lesson 2: Collections
A misspelt folder once said nothing
Newman has not always reported a folder name it could not find. Its changelog for version 6.0.0, dated 15 September 2023, lists a fixed bug: an invalid folder input used to exit silently. Before that release, a run given a misspelt folder name could end there and then, with no message to say why.
Why it fits here: It answers this topic's question: the clear error for an unknown folder name arrived only with Newman 6.0.0, in 2023.
Source: Newman's changelog
Topic: Folders and their order · history, mistakes
Folders inside folders, then several at once
Newman learned folders in steps. Version 3.5.0, of 7 March 2017, added folders inside folders to its command-line, HTML and JUnit reports. Version 4.1.0, of 29 August 2018, added the ability to choose several folders for one run, which is why the folder option can take a list, and --folder can be given more than once.
Why it fits here: It dates this topic's folder option: several folders in one run have been possible since Newman 4.1.0, in 2018.
Source: Newman's changelog
Topic: Folders and their order · history, tools
Variables that make up data
Postman can invent test data on its own. Variables whose names start with a dollar sign, such as {{$guid}} and {{$timestamp}}, get a fresh value each time a request runs, generated by the Faker library. The list is long and playful: {{$randomFirstName}}, {{$randomCity}}, the URL of a random cat image, and {{$randomBs}}, a random phrase of business-speak.
Why it fits here: It answers this topic's question: Postman's dynamic variables, whose names start with a dollar sign, make up fresh data for every request.
Source: Postman Docs: Use dynamic variables to return randomly generated data
Topic: Collection variables · tools
A newer API than it looks
The pm.collectionVariables that scripts use in this lesson is younger than it looks. postman-sandbox, the engine that runs Postman's scripts, added support for it in version 3.4.0, dated 1 October 2019. The same changelog shows the engine growing feature by feature, each one listed with the date it arrived.
Why it fits here: It dates this topic's script API: pm.collectionVariables reached Postman's script engine in October 2019.
Source: postman-sandbox's changelog
Topic: Collection variables · history, tools
A toolbox built into every script
Postman's scripts come with libraries already inside. Its documentation says the require method gives a script the sandbox's built-in library modules, among them lodash, moment, cheerio, chai and xml2js, with nothing to install. A few older ones, such as crypto-js, atob, btoa and tv4, are now listed as deprecated and no longer supported, each with a modern replacement.
Why it fits here: It answers this topic's question: require gives a Postman script built-in libraries such as lodash, with nothing to install.
Source: Postman Docs: Import packages into your scripts
Topic: Scripts for a whole collection · tools
The old way of writing tests
Before pm, Postman's scripts used bare names such as tests, responseCode and responseBody. postman-sandbox 4.7.0, dated 1 April 2024, deprecated these legacy APIs and added a warning in the console when a script uses one. Its code pairs each old name with its replacement: tests with pm.test(), and responseCode with pm.response.code.
Why it fits here: It explains the scripts of old tutorials: the bare names they use are legacy APIs, deprecated in 2024 in favour of pm.
Sources: postman-sandbox's changelog; postman-sandbox: the legacy interface
Topic: Scripts for a whole collection · history, mistakes
A run that steers itself
A collection run does not have to follow the list. Postman's documentation shows a test calling pm.execution.setNextRequest() to name the request that runs next. Given the current request's own name, it runs that request again after it completes, a loop; given null, the collection run stops after the current request runs.
Why it fits here: It answers this topic's question: setNextRequest lets a run pick its next request, loop over one, or stop.
Source: Postman Docs: Customize request order in a collection run
Topic: Running the whole collection · tools
Many users at once
The Collection Runner can also test speed. In a performance test, Postman runs a collection with a chosen number of virtual users. Each virtual user runs the requests in order, in a repeating loop, and all of them work in parallel to stand for real users at once. The load can stay fixed, ramp up, or spike and fall back.
Why it fits here: It shows another use of this topic's runner: the same collection, run by many virtual users at once, tests an API's speed under load.
Source: Postman Docs: Configure and run performance tests
Topic: Running the whole collection · tools
Lesson 3: Environments and variables
Nineteen layers deep
A variable's value may hold another variable, as a baseUrl of http://{{host}}:3000 does. Postman's collection library fills such values in passes, and its code sets a limit: the substitution repeats at most 19 times until all the names are resolved. So a chain of variables nested more than 19 deep would leave braces behind.
Why it fits here: It answers this topic's question: a variable may hold another, and Postman's library repeats the filling in at most 19 times.
Source: postman-collection: lib/superstring/index.js
Topic: Environments: one collection, many servers · tools
A colour for each server
Picking the wrong environment can send a test to the real server. Postman lets you give each environment a colour, so that people can tell them apart and pick the right one at a glance. Its documentation adds that the colour stays with an environment when it is copied, forked or moved into another workspace.
Why it fits here: It meets this topic's danger: a colour per environment helps people tell the practice server from the real one.
Source: Postman Docs: Organize your workspace environments with colors
Topic: Environments: one collection, many servers · tools, mistakes
Your values stay on your machine
By default, a variable's value in Postman stays on your machine. The documentation says that collection, environment and global values are only available locally, in your own instance of Postman, and are not synced to the Postman Cloud. A value you choose to share is synced, and features that run in the cloud, such as monitors and the Postman CLI, use that shared value.
Why it fits here: It answers this topic's question: values you type stay local unless you share them, and cloud features use the shared value.
Source: Postman Docs: Store and reuse values using variables
Topic: Five scopes, and who wins · tools, security
A vault for secrets
Keys and passwords have a safer home than any scope: Postman Vault, which keeps them as vault secrets in encrypted storage. In the Local Vault, the documentation says, only you can reach your secrets, and they are not synced to the Postman Cloud. A request can use a secret without the secret ever being written into a collection or an environment.
Why it fits here: It adds a safer place beside this topic's scopes: secrets kept encrypted in a vault, on your own machine.
Source: Postman Docs: Store secrets in Postman Vault
Topic: Five scopes, and who wins · security, tools
Serial numbers that told a secret
Ids that count up, 1, 2, 3, tell anyone how many things exist. In the Second World War, Allied statisticians estimated German tank production from the serial numbers on captured tanks. The Guardian reported that they estimated 246 tanks a month, while ordinary intelligence believed around 1,400; German records later showed 245. Statisticians still call it the German tank problem.
Why it fits here: It answers this topic's question: ids that count up reveal how many there are, which is why many servers prefer random ids.
Sources: Wikipedia: German tank problem; The Guardian: Gavyn Davies does the maths
Topic: Passing a value to the next request · history, security
The address of the new thing
A server can hand over more than an id. RFC 9110, the standard for HTTP's meaning, says a 201 Created answer identifies the new resource by a Location header, or, when there is none, by the address the request was sent to. A client can then follow Location, instead of building the next address from an id itself.
Why it fits here: It shows a standard way to chain: a 201's Location header names the address of the thing just made.
Source: RFC 9110: HTTP Semantics
Topic: Passing a value to the next request · standards, internet
Common for decades, written down in 2005
CSV is older than its standard. RFC 4180, of October 2005, says the format had been used to exchange and convert data between spreadsheet programs for quite some time, and then adds: surprisingly, while this format is very common, it has never been formally documented. That RFC finally wrote down a common form, with a header line and quotes around fields that hold commas.
Why it fits here: It answers this topic's question: CSV was in use for years before RFC 4180 wrote it down in 2005.
Source: RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files
Topic: A data file: one round per row · history, standards
A cell that runs a formula
A CSV file can be dangerous to open. OWASP, the web security project, describes CSV Injection, also called Formula Injection: when a spreadsheet program such as Microsoft Excel or LibreOffice Calc opens a CSV, any cell starting with = is read as a formula. A site that writes untrusted text into a CSV can hand its users a file that runs someone else's formula.
Why it fits here: It warns about this topic's files: a CSV opened in a spreadsheet treats a cell starting with = as a formula.
Source: OWASP: CSV Injection
Topic: A data file: one round per row · security, mistakes
Lesson 4: Tests in Postman
Names that read as sentences
Test names written as sentences come from BDD, behaviour-driven development. Dan North introduced it in an article of 20 September 2006, which begins: I had a problem. Programmers he taught kept asking where to start, what to test, what to call their tests and how to understand why a test fails. His first answer was that test method names should be sentences.
Why it fits here: It answers this topic's question: naming tests as sentences came from Dan North's BDD, to make a failing test explain itself.
Source: Dan North: Introducing BDD
Topic: What a test is · history, people
Where API tests sit in the pyramid
Teams often picture their tests as a pyramid. Martin Fowler writes that most people know the test pyramid from Mike Cohn, who described it in his 2009 book Succeeding with Agile. Its point, in Fowler's words, is that you should have many more low-level unit tests than high-level tests that run through a screen; API tests like this lesson's sit in the middle.
Why it fits here: It places this topic's tests: API tests sit between many small unit tests and a few slow tests through the screen.
Source: Martin Fowler: TestPyramid
Topic: What a test is · history, tools
A cut at forty characters
The shortened values in Chai's messages follow a setting. Chai's documentation lists config.truncateThreshold, with a default of 40: when an actual or expected value in an assertion error is longer than that, it is truncated. Set it to zero, the documentation adds, if you want to disable truncating altogether.
Why it fits here: It answers this topic's question: Chai cuts long values at its truncateThreshold, 40 by default, and 0 turns the cutting off.
Source: Chai: Assertion Styles
Topic: Checking values with pm.expect · tools
A style that changes every object
Chai has more than one style. Besides expect, which Postman uses, there is should, which reads value.should.equal(3). Chai's documentation explains the catch: should extends each object with a should property to start the chain, and it warns that this style has some issues in Internet Explorer. expect leaves your objects alone.
Why it fits here: It explains why this topic's pm.expect is Chai's expect style: should adds a property to every object, expect adds nothing.
Source: Chai: Assertion Styles
Topic: Checking values with pm.expect · tools
A JSON object has no order
The fields of a JSON object have no order. RFC 8259, the JSON standard of December 2017, defines an object as an unordered collection of name and value pairs, and notes that parsers differ on whether they show the order to programs at all. Software whose behaviour does not depend on the order works the same everywhere.
Why it fits here: It answers this topic's question: a JSON object is unordered, so a check should find fields by name, never by their position.
Source: RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format
Topic: Checking the response itself · standards
A status for content that cannot be processed
The gauges server refuses a value that is not a number with 400 Bad Request. HTTP has a closer fit. RFC 9110 defines 422 Unprocessable Content for a request whose content type is understood and whose syntax is correct. The server was still unable to process it. A reading of twelve, written in words, is valid JSON that cannot be stored.
Why it fits here: It sharpens this topic's refusal tests: 422 says the request was well formed but its content could not be processed.
Source: RFC 9110: HTTP Semantics
Topic: Checking the response itself · standards, internet
Born on a flight to Atlanta
Small automated tests spread through JUnit, a testing tool for Java. Martin Fowler, one of its early adopters, wrote that JUnit was born on a flight from Zurich to the 1997 OOPSLA conference in Atlanta, where Kent Beck was flying with Erich Gamma. With a long flight ahead, the two of them spent it programming.
Why it fits here: It answers this topic's question: the habit spread through JUnit, which Kent Beck and Erich Gamma began on a flight in 1997.
Sources: Martin Fowler: Xunit; Wikipedia: JUnit
Topic: Failures, the summary and the exit code · history, people
Five reporters, one with emoji
Newman's own report is only one of several. Its README lists five built-in reporters: cli, json, junit, progress and emojitrain. The junit reporter writes the run's summary as a JUnit compatible XML file, the format that build servers read, named after the JUnit tool. And emojitrain does what its name suggests.
Why it fits here: It extends this topic's reports: Newman has five built-in reporters, from junit's XML for build servers to emojitrain.
Source: Newman on GitHub: README
Topic: Failures, the summary and the exit code · tools
No fact matches. Try a shorter word, or take the tag off.