SlideShare a Scribd company logo
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Testing your APIs with
Postman and Newman
Mike Amundsen
@mamund
youtube.com/mamund
copyright © 2021 by amundsen.com, inc. -- all rights reserved
2
copyright © 2021 by amundsen.com, inc. -- all rights reserved
"From design to code to test to
deployment, unlock hidden business value
and release stable and scalable web APIs
that meet customer needs and solve
important business problems in a
consistent and reliable manner."
-- Pragmatic Publishers
g.mamund.com/GreatWebAPIs
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Overview
● The Goals of API Testing
● Simple Request Testing with SRTs
● Testing with Postman UI and ChaiJS Assertions
● Automate Testing with Newman CLI
● Summary
copyright © 2021 by amundsen.com, inc. -- all rights reserved
The Goals of API Testing
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Goals of API Testing
● "Outside-in" approach
● Validating resource inputs/outputs
● Confirming interface behavior
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Goals of API Testing
● "Outside-in" approach
○ We can only "see" the API
○ Your tests are for the interface, not the code
● Validating resource inputs/outputs
● Confirming interface behavior
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Goals of API Testing
● "Outside-in" approach
● Validating resource inputs/outputs
○ Confirm the URL exists, responds
○ Validate the methods, parameters, and response bodies
● Confirming interface behavior
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Goals of API Testing
● "Outside-in" approach
● Validating resource inputs/outputs
● Confirming interface behavior
○ Validate expected behaviors
○ Happy-path tests (200 OK)
○ Sad-path tests (400 Bad Request)
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Let's see how that works...
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Simple Request Testing with SRTs
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Simple Request Testing (SRTs)
● SRTs are a great way to validate endpoints
● Use curl to execute simple requests against your API
● "Eyeball" the results to make sure it works as expected
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Simple Request Testing (SRTs)
● SRTs are a great way to validate endpoints
○ Confirm URLs respond
○ Validate 200 OK & body
● Use curl to execute simple requests against your API
● "Eyeball" the results to make sure it works as expected
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Simple Request Testing (SRTs)
● SRTs are a great way to validate endpoints
● Use curl to execute simple requests against your API
○ curl or wget or any other simple HTTP CLI client works fine
○ Pipe results to a file (output.txt) and check into source control
● "Eyeball" the results to make sure it works as expected
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Simple Request Testing (SRTs)
● SRTs are a great way to validate endpoints
● Use curl to execute simple requests against your API
● "Eyeball" the results to make sure it works as expected
○ Does the request fail?
○ Does the body "look ok?"
copyright © 2021 by amundsen.com, inc. -- all rights reserved
SRT Demo
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Testing with Postman UI and ChaiJS
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Postman UI and ChaiJS
● Postman API platform (2014)
● Collections -> Folders -> Requests
● Embedded libraries for scripting tests
● ChaiJS assertions
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Postman UI and ChaiJS
● Postman API platform (2014)
○ Design, build, mock, test, etc.
○ May require a client-side install
● Collections -> Folders -> Requests
● Embedded libraries for scripting tests
● ChaiJS assertions
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Postman UI and ChaiJS
● Postman API platform (2014)
● Collections -> Folders -> Requests
○ You can import/export collections
○ Supports global, collection, and environment memory sharing
● Embedded libraries for scripting tests
● ChaiJS assertions
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Postman UI and ChaiJS
● Postman API platform (2014)
● Collections -> Folders -> Requests
● Embedded libraries for scripting tests
○ 12+ client-side libraries
○ 10+ NodeJS libraries
● ChaiJS assertions
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Postman UI and ChaiJS
● Postman API platform (2014)
● Collections -> Folders -> Requests
● Embedded libraries for scripting tests
● ChaiJS assertions
○ BDD-style assertions
○ Fluent interface
○ should(...), expect(...), assert(...)
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Postman UI Demo
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
● Newman (2016) is the command-line client for Postman
● Use Postman API for managing collections & environments
● Newman + API = custom test-run scripts
● Add -reporters option for improved output
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
● Newman is the command-line client for Postman (2016)
○ npm install -g newman
○ newman run <collection>
● Postman API for managing collections & environments
● Newman + API = custom test-run scripts
● Add -reporters option for improved output
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
● Newman is the command-line client for Postman (2016)
● Postman API for managing collections & environments
○ Generate your API key
○ Use curl to make postman API calls for collections & environments
● Newman + API = custom test-run scripts
● Add -reporters option for improved output
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
● Newman is the command-line client for Postman (2016)
● Postman API for managing collections & environments
● Newman + API = custom test-run scripts
○ Pull proper collections/environments (API)
○ Run tests and report results (Newman)
○ test-run.sh local
● Add -reporters option for improved output
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
● Newman is the command-line client for Postman (2016)
● Postman API for managing collections & environments
● Newman + API = custom test-run scripts
● Add -reporters option for improved output
○ npm install -g newman-reporter-htmlextra
○ newman run <collection> -r htmlextra
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Newman CLI Demo
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Putting it all together
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Putting It All Together w/ a "mini-pipeline"
● Build
● Local Test
● Deploy
● Remote Test
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Putting It All Together w/ a "mini-pipeline"
● Build
○ npm run dev
● Local Test
○ test-run.sh local
● Deploy
○ git push heroku master
● Remote Test
○ test-run.sh remote
copyright © 2021 by amundsen.com, inc. -- all rights reserved
mini-pipeline Demo
copyright © 2021 by amundsen.com, inc. -- all rights reserved
And So...
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Goals of API Testing
● Outside-in approach
● Testing the API's behavior
● Happy- and Sad-Path testing
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Validate Endpoints with SRTs
● Focus on URLs and arguments
● Use the srt.sh script with curl
● That's really "testing" yet <g>
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Test Behavior with Postman and ChaiJS
● Create Postman test collections
● Use ChaiJS assertion library BDD-style "outside-in"
● Build up reusable test modules and share via global memory
● Be sure to use both Happy- and Sad-Path tests
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Automate Testing with Newman CLI
● Newman is the Postman CLI client
● Automate testing using test-run.sh
● Optionally, use -r htmlextra option for HTML output
copyright © 2021 by amundsen.com, inc. -- all rights reserved
That's all there is!
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Resources
● "Design and Build Great Web APIs"
g.mamund.com/greatwebapis
● This talk (slides, links, etc.)
g.mamund.com/2021-02-postman-galaxy-testing
copyright © 2021 by amundsen.com, inc. -- all rights reserved
Testing your APIs with
Postman and Newman
Mike Amundsen
@mamund
youtube.com/mamund
Ad

More Related Content

What's hot (20)

Postman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptxPostman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptx
Postman
 
Belajar Postman test runner
Belajar Postman test runnerBelajar Postman test runner
Belajar Postman test runner
Fachrul Choliluddin
 
Api testing
Api testingApi testing
Api testing
HamzaMajid13
 
Accelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsAccelerate Quality with Postman - Basics
Accelerate Quality with Postman - Basics
Knoldus Inc.
 
API Testing for everyone.pptx
API Testing for everyone.pptxAPI Testing for everyone.pptx
API Testing for everyone.pptx
Pricilla Bilavendran
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
Mithilesh Singh
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
ParrotBAD
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman Introduction
Rahul Agarwal
 
Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST API
Ivan Katunou
 
Api Testing
Api TestingApi Testing
Api Testing
Vishwanath KC
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
Bruno Pedro
 
Postman 101 & Office Hours
Postman 101 & Office HoursPostman 101 & Office Hours
Postman 101 & Office Hours
Postman
 
Space Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdfSpace Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdf
Postman
 
Postman
PostmanPostman
Postman
Igor Shubovych
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
Sauce Labs
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Continuous Quality with Postman
Continuous Quality with PostmanContinuous Quality with Postman
Continuous Quality with Postman
Postman
 
Reasons To Automate API Testing Process
Reasons To Automate API Testing ProcessReasons To Automate API Testing Process
Reasons To Automate API Testing Process
QASource
 
Advanced API Debugging
Advanced API DebuggingAdvanced API Debugging
Advanced API Debugging
Postman
 
POSTMAN.pptx
POSTMAN.pptxPOSTMAN.pptx
POSTMAN.pptx
RamaKrishna970827
 
Postman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptxPostman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptx
Postman
 
Accelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsAccelerate Quality with Postman - Basics
Accelerate Quality with Postman - Basics
Knoldus Inc.
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
Mithilesh Singh
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman Introduction
Rahul Agarwal
 
Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST API
Ivan Katunou
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
Bruno Pedro
 
Postman 101 & Office Hours
Postman 101 & Office HoursPostman 101 & Office Hours
Postman 101 & Office Hours
Postman
 
Space Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdfSpace Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdf
Postman
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
Sauce Labs
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Continuous Quality with Postman
Continuous Quality with PostmanContinuous Quality with Postman
Continuous Quality with Postman
Postman
 
Reasons To Automate API Testing Process
Reasons To Automate API Testing ProcessReasons To Automate API Testing Process
Reasons To Automate API Testing Process
QASource
 
Advanced API Debugging
Advanced API DebuggingAdvanced API Debugging
Advanced API Debugging
Postman
 

Similar to Testing Your APIs: Postman, Newman, and Beyond (20)

apidays LIVE New York - Building Great Web APIs by Mike Amundsen
apidays LIVE New York - Building Great Web APIs by Mike Amundsenapidays LIVE New York - Building Great Web APIs by Mike Amundsen
apidays LIVE New York - Building Great Web APIs by Mike Amundsen
apidays
 
INTERFACE by apidays_Building Great Web APIs by Mike Amundsen
INTERFACE by apidays_Building Great Web APIs by Mike AmundsenINTERFACE by apidays_Building Great Web APIs by Mike Amundsen
INTERFACE by apidays_Building Great Web APIs by Mike Amundsen
apidays
 
INTERFACE, by apidays - Design and Build Great Web APIs
INTERFACE, by apidays - Design and Build Great Web APIsINTERFACE, by apidays - Design and Build Great Web APIs
INTERFACE, by apidays - Design and Build Great Web APIs
apidays
 
apidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsen
apidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsenapidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsen
apidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsen
apidays
 
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
Amazon Web Services Korea
 
Abhay-Resume
Abhay-ResumeAbhay-Resume
Abhay-Resume
Abhay Magadum
 
Angular Unleashed : Mastering the Beast of Web Development.pptx
Angular Unleashed : Mastering the Beast of Web Development.pptxAngular Unleashed : Mastering the Beast of Web Development.pptx
Angular Unleashed : Mastering the Beast of Web Development.pptx
Gaurav Madaan
 
Aarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinarAarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinar
aarnanetworks
 
Delivery Pipelines as a First Class Citizen @deliverAgile2019
Delivery Pipelines as a First Class Citizen @deliverAgile2019Delivery Pipelines as a First Class Citizen @deliverAgile2019
Delivery Pipelines as a First Class Citizen @deliverAgile2019
ciberkleid
 
Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...
Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...
Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...
HostedbyConfluent
 
re:Invent 2023 - The Pragmatic Serverless Python Developer
re:Invent 2023 - The Pragmatic Serverless Python Developerre:Invent 2023 - The Pragmatic Serverless Python Developer
re:Invent 2023 - The Pragmatic Serverless Python Developer
Heitor Lessa
 
CI/CD using AWS developer tools
CI/CD using AWS developer toolsCI/CD using AWS developer tools
CI/CD using AWS developer tools
AWS User Group Bengaluru
 
App-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai EasyApp-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai Easy
Akamai Developers & Admins
 
How Zalando integrates Kubernetes with AWS
How Zalando integrates Kubernetes with AWSHow Zalando integrates Kubernetes with AWS
How Zalando integrates Kubernetes with AWS
Uri Savelchev
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
GlobalLogic Ukraine
 
Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17
Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17
Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17
Muga Nishizawa
 
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
Bhuvaneswari Subramani
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design Patterns
Bilgin Ibryam
 
Optimizing your API to Perform at Scale
Optimizing your API to Perform at ScaleOptimizing your API to Perform at Scale
Optimizing your API to Perform at Scale
Akamai Developers & Admins
 
Community day _aws_ci_cd_v0.2
Community day _aws_ci_cd_v0.2Community day _aws_ci_cd_v0.2
Community day _aws_ci_cd_v0.2
VijayaNirmalaGopal
 
apidays LIVE New York - Building Great Web APIs by Mike Amundsen
apidays LIVE New York - Building Great Web APIs by Mike Amundsenapidays LIVE New York - Building Great Web APIs by Mike Amundsen
apidays LIVE New York - Building Great Web APIs by Mike Amundsen
apidays
 
INTERFACE by apidays_Building Great Web APIs by Mike Amundsen
INTERFACE by apidays_Building Great Web APIs by Mike AmundsenINTERFACE by apidays_Building Great Web APIs by Mike Amundsen
INTERFACE by apidays_Building Great Web APIs by Mike Amundsen
apidays
 
INTERFACE, by apidays - Design and Build Great Web APIs
INTERFACE, by apidays - Design and Build Great Web APIsINTERFACE, by apidays - Design and Build Great Web APIs
INTERFACE, by apidays - Design and Build Great Web APIs
apidays
 
apidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsen
apidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsenapidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsen
apidays LIVE JAKARTA - GraphQL, gRPC, REST, Oh My! by Mike Amundsen
apidays
 
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
Amazon Web Services Korea
 
Angular Unleashed : Mastering the Beast of Web Development.pptx
Angular Unleashed : Mastering the Beast of Web Development.pptxAngular Unleashed : Mastering the Beast of Web Development.pptx
Angular Unleashed : Mastering the Beast of Web Development.pptx
Gaurav Madaan
 
Aarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinarAarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinar
aarnanetworks
 
Delivery Pipelines as a First Class Citizen @deliverAgile2019
Delivery Pipelines as a First Class Citizen @deliverAgile2019Delivery Pipelines as a First Class Citizen @deliverAgile2019
Delivery Pipelines as a First Class Citizen @deliverAgile2019
ciberkleid
 
Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...
Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...
Verifying Apache Kafka-Based Data Pipelines With Subhangi Agarwala | Current ...
HostedbyConfluent
 
re:Invent 2023 - The Pragmatic Serverless Python Developer
re:Invent 2023 - The Pragmatic Serverless Python Developerre:Invent 2023 - The Pragmatic Serverless Python Developer
re:Invent 2023 - The Pragmatic Serverless Python Developer
Heitor Lessa
 
App-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai EasyApp-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai Easy
Akamai Developers & Admins
 
How Zalando integrates Kubernetes with AWS
How Zalando integrates Kubernetes with AWSHow Zalando integrates Kubernetes with AWS
How Zalando integrates Kubernetes with AWS
Uri Savelchev
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
GlobalLogic Ukraine
 
Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17
Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17
Custom Script Execution Environment on TD Workflow @ TD Tech Talk 2018-10-17
Muga Nishizawa
 
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
Bhuvaneswari Subramani
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design Patterns
Bilgin Ibryam
 
Ad

More from Postman (20)

Advanced AI and Documentation Techniques
Advanced AI and Documentation TechniquesAdvanced AI and Documentation Techniques
Advanced AI and Documentation Techniques
Postman
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Elevating Developer Experiences with AI-Powered API Testing & Documentation
Elevating Developer Experiences with AI-Powered API Testing & DocumentationElevating Developer Experiences with AI-Powered API Testing & Documentation
Elevating Developer Experiences with AI-Powered API Testing & Documentation
Postman
 
Discovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with PostmanDiscovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with Postman
Postman
 
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for CollaborationOptimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Postman
 
API testing Beyond the Basics AI & Automation Techniques
API testing Beyond the Basics AI & Automation TechniquesAPI testing Beyond the Basics AI & Automation Techniques
API testing Beyond the Basics AI & Automation Techniques
Postman
 
Not Your Grandma’s Rate Limiting (slides)
Not Your Grandma’s Rate Limiting (slides)Not Your Grandma’s Rate Limiting (slides)
Not Your Grandma’s Rate Limiting (slides)
Postman
 
Five Ways to Automate API Testing with Postman
Five Ways to Automate API Testing with PostmanFive Ways to Automate API Testing with Postman
Five Ways to Automate API Testing with Postman
Postman
 
How to Scale APIs-as-Product for Future Success
How to Scale APIs-as-Product for Future SuccessHow to Scale APIs-as-Product for Future Success
How to Scale APIs-as-Product for Future Success
Postman
 
Revolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with PostmanRevolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with Postman
Postman
 
Everything You Always Wanted to Know About AsyncAPI
Everything You Always Wanted to Know About AsyncAPIEverything You Always Wanted to Know About AsyncAPI
Everything You Always Wanted to Know About AsyncAPI
Postman
 
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Postman
 
Five Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman
 
Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs
Postman
 
How ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in PopularityHow ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in Popularity
Postman
 
Exploring Postman’s VS Code Extension
Exploring Postman’s VS Code ExtensionExploring Postman’s VS Code Extension
Exploring Postman’s VS Code Extension
Postman
 
2023 State of the API Report: Key Findings and Trends
2023 State of the API Report: Key Findings and Trends2023 State of the API Report: Key Findings and Trends
2023 State of the API Report: Key Findings and Trends
Postman
 
Nordic- APIOps is here What will you build in an API First World
Nordic- APIOps is here What will you build in an API First World Nordic- APIOps is here What will you build in an API First World
Nordic- APIOps is here What will you build in an API First World
Postman
 
Testing and Developing gRPC APIs
Testing and Developing gRPC APIsTesting and Developing gRPC APIs
Testing and Developing gRPC APIs
Postman
 
Testing and Developing GraphQL APIs
Testing and Developing GraphQL APIsTesting and Developing GraphQL APIs
Testing and Developing GraphQL APIs
Postman
 
Advanced AI and Documentation Techniques
Advanced AI and Documentation TechniquesAdvanced AI and Documentation Techniques
Advanced AI and Documentation Techniques
Postman
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Elevating Developer Experiences with AI-Powered API Testing & Documentation
Elevating Developer Experiences with AI-Powered API Testing & DocumentationElevating Developer Experiences with AI-Powered API Testing & Documentation
Elevating Developer Experiences with AI-Powered API Testing & Documentation
Postman
 
Discovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with PostmanDiscovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with Postman
Postman
 
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for CollaborationOptimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Postman
 
API testing Beyond the Basics AI & Automation Techniques
API testing Beyond the Basics AI & Automation TechniquesAPI testing Beyond the Basics AI & Automation Techniques
API testing Beyond the Basics AI & Automation Techniques
Postman
 
Not Your Grandma’s Rate Limiting (slides)
Not Your Grandma’s Rate Limiting (slides)Not Your Grandma’s Rate Limiting (slides)
Not Your Grandma’s Rate Limiting (slides)
Postman
 
Five Ways to Automate API Testing with Postman
Five Ways to Automate API Testing with PostmanFive Ways to Automate API Testing with Postman
Five Ways to Automate API Testing with Postman
Postman
 
How to Scale APIs-as-Product for Future Success
How to Scale APIs-as-Product for Future SuccessHow to Scale APIs-as-Product for Future Success
How to Scale APIs-as-Product for Future Success
Postman
 
Revolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with PostmanRevolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with Postman
Postman
 
Everything You Always Wanted to Know About AsyncAPI
Everything You Always Wanted to Know About AsyncAPIEverything You Always Wanted to Know About AsyncAPI
Everything You Always Wanted to Know About AsyncAPI
Postman
 
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Postman
 
Five Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman
 
Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs
Postman
 
How ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in PopularityHow ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in Popularity
Postman
 
Exploring Postman’s VS Code Extension
Exploring Postman’s VS Code ExtensionExploring Postman’s VS Code Extension
Exploring Postman’s VS Code Extension
Postman
 
2023 State of the API Report: Key Findings and Trends
2023 State of the API Report: Key Findings and Trends2023 State of the API Report: Key Findings and Trends
2023 State of the API Report: Key Findings and Trends
Postman
 
Nordic- APIOps is here What will you build in an API First World
Nordic- APIOps is here What will you build in an API First World Nordic- APIOps is here What will you build in an API First World
Nordic- APIOps is here What will you build in an API First World
Postman
 
Testing and Developing gRPC APIs
Testing and Developing gRPC APIsTesting and Developing gRPC APIs
Testing and Developing gRPC APIs
Postman
 
Testing and Developing GraphQL APIs
Testing and Developing GraphQL APIsTesting and Developing GraphQL APIs
Testing and Developing GraphQL APIs
Postman
 
Ad

Recently uploaded (20)

Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 

Testing Your APIs: Postman, Newman, and Beyond

  • 1. copyright © 2021 by amundsen.com, inc. -- all rights reserved Testing your APIs with Postman and Newman Mike Amundsen @mamund youtube.com/mamund
  • 2. copyright © 2021 by amundsen.com, inc. -- all rights reserved 2
  • 3. copyright © 2021 by amundsen.com, inc. -- all rights reserved "From design to code to test to deployment, unlock hidden business value and release stable and scalable web APIs that meet customer needs and solve important business problems in a consistent and reliable manner." -- Pragmatic Publishers g.mamund.com/GreatWebAPIs
  • 4. copyright © 2021 by amundsen.com, inc. -- all rights reserved Overview ● The Goals of API Testing ● Simple Request Testing with SRTs ● Testing with Postman UI and ChaiJS Assertions ● Automate Testing with Newman CLI ● Summary
  • 5. copyright © 2021 by amundsen.com, inc. -- all rights reserved The Goals of API Testing
  • 6. copyright © 2021 by amundsen.com, inc. -- all rights reserved Goals of API Testing ● "Outside-in" approach ● Validating resource inputs/outputs ● Confirming interface behavior
  • 7. copyright © 2021 by amundsen.com, inc. -- all rights reserved Goals of API Testing ● "Outside-in" approach ○ We can only "see" the API ○ Your tests are for the interface, not the code ● Validating resource inputs/outputs ● Confirming interface behavior
  • 8. copyright © 2021 by amundsen.com, inc. -- all rights reserved Goals of API Testing ● "Outside-in" approach ● Validating resource inputs/outputs ○ Confirm the URL exists, responds ○ Validate the methods, parameters, and response bodies ● Confirming interface behavior
  • 9. copyright © 2021 by amundsen.com, inc. -- all rights reserved Goals of API Testing ● "Outside-in" approach ● Validating resource inputs/outputs ● Confirming interface behavior ○ Validate expected behaviors ○ Happy-path tests (200 OK) ○ Sad-path tests (400 Bad Request)
  • 10. copyright © 2021 by amundsen.com, inc. -- all rights reserved Let's see how that works...
  • 11. copyright © 2021 by amundsen.com, inc. -- all rights reserved Simple Request Testing with SRTs
  • 12. copyright © 2021 by amundsen.com, inc. -- all rights reserved Simple Request Testing (SRTs) ● SRTs are a great way to validate endpoints ● Use curl to execute simple requests against your API ● "Eyeball" the results to make sure it works as expected
  • 13. copyright © 2021 by amundsen.com, inc. -- all rights reserved Simple Request Testing (SRTs) ● SRTs are a great way to validate endpoints ○ Confirm URLs respond ○ Validate 200 OK & body ● Use curl to execute simple requests against your API ● "Eyeball" the results to make sure it works as expected
  • 14. copyright © 2021 by amundsen.com, inc. -- all rights reserved Simple Request Testing (SRTs) ● SRTs are a great way to validate endpoints ● Use curl to execute simple requests against your API ○ curl or wget or any other simple HTTP CLI client works fine ○ Pipe results to a file (output.txt) and check into source control ● "Eyeball" the results to make sure it works as expected
  • 15. copyright © 2021 by amundsen.com, inc. -- all rights reserved Simple Request Testing (SRTs) ● SRTs are a great way to validate endpoints ● Use curl to execute simple requests against your API ● "Eyeball" the results to make sure it works as expected ○ Does the request fail? ○ Does the body "look ok?"
  • 16. copyright © 2021 by amundsen.com, inc. -- all rights reserved SRT Demo
  • 17. copyright © 2021 by amundsen.com, inc. -- all rights reserved Testing with Postman UI and ChaiJS
  • 18. copyright © 2021 by amundsen.com, inc. -- all rights reserved Postman UI and ChaiJS ● Postman API platform (2014) ● Collections -> Folders -> Requests ● Embedded libraries for scripting tests ● ChaiJS assertions
  • 19. copyright © 2021 by amundsen.com, inc. -- all rights reserved Postman UI and ChaiJS ● Postman API platform (2014) ○ Design, build, mock, test, etc. ○ May require a client-side install ● Collections -> Folders -> Requests ● Embedded libraries for scripting tests ● ChaiJS assertions
  • 20. copyright © 2021 by amundsen.com, inc. -- all rights reserved Postman UI and ChaiJS ● Postman API platform (2014) ● Collections -> Folders -> Requests ○ You can import/export collections ○ Supports global, collection, and environment memory sharing ● Embedded libraries for scripting tests ● ChaiJS assertions
  • 21. copyright © 2021 by amundsen.com, inc. -- all rights reserved Postman UI and ChaiJS ● Postman API platform (2014) ● Collections -> Folders -> Requests ● Embedded libraries for scripting tests ○ 12+ client-side libraries ○ 10+ NodeJS libraries ● ChaiJS assertions
  • 22. copyright © 2021 by amundsen.com, inc. -- all rights reserved Postman UI and ChaiJS ● Postman API platform (2014) ● Collections -> Folders -> Requests ● Embedded libraries for scripting tests ● ChaiJS assertions ○ BDD-style assertions ○ Fluent interface ○ should(...), expect(...), assert(...)
  • 23. copyright © 2021 by amundsen.com, inc. -- all rights reserved Postman UI Demo
  • 24. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI
  • 25. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI ● Newman (2016) is the command-line client for Postman ● Use Postman API for managing collections & environments ● Newman + API = custom test-run scripts ● Add -reporters option for improved output
  • 26. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI ● Newman is the command-line client for Postman (2016) ○ npm install -g newman ○ newman run <collection> ● Postman API for managing collections & environments ● Newman + API = custom test-run scripts ● Add -reporters option for improved output
  • 27. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI ● Newman is the command-line client for Postman (2016) ● Postman API for managing collections & environments ○ Generate your API key ○ Use curl to make postman API calls for collections & environments ● Newman + API = custom test-run scripts ● Add -reporters option for improved output
  • 28. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI ● Newman is the command-line client for Postman (2016) ● Postman API for managing collections & environments ● Newman + API = custom test-run scripts ○ Pull proper collections/environments (API) ○ Run tests and report results (Newman) ○ test-run.sh local ● Add -reporters option for improved output
  • 29. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI ● Newman is the command-line client for Postman (2016) ● Postman API for managing collections & environments ● Newman + API = custom test-run scripts ● Add -reporters option for improved output ○ npm install -g newman-reporter-htmlextra ○ newman run <collection> -r htmlextra
  • 30. copyright © 2021 by amundsen.com, inc. -- all rights reserved Newman CLI Demo
  • 31. copyright © 2021 by amundsen.com, inc. -- all rights reserved Putting it all together
  • 32. copyright © 2021 by amundsen.com, inc. -- all rights reserved Putting It All Together w/ a "mini-pipeline" ● Build ● Local Test ● Deploy ● Remote Test
  • 33. copyright © 2021 by amundsen.com, inc. -- all rights reserved Putting It All Together w/ a "mini-pipeline" ● Build ○ npm run dev ● Local Test ○ test-run.sh local ● Deploy ○ git push heroku master ● Remote Test ○ test-run.sh remote
  • 34. copyright © 2021 by amundsen.com, inc. -- all rights reserved mini-pipeline Demo
  • 35. copyright © 2021 by amundsen.com, inc. -- all rights reserved And So...
  • 36. copyright © 2021 by amundsen.com, inc. -- all rights reserved Goals of API Testing ● Outside-in approach ● Testing the API's behavior ● Happy- and Sad-Path testing
  • 37. copyright © 2021 by amundsen.com, inc. -- all rights reserved Validate Endpoints with SRTs ● Focus on URLs and arguments ● Use the srt.sh script with curl ● That's really "testing" yet <g>
  • 38. copyright © 2021 by amundsen.com, inc. -- all rights reserved Test Behavior with Postman and ChaiJS ● Create Postman test collections ● Use ChaiJS assertion library BDD-style "outside-in" ● Build up reusable test modules and share via global memory ● Be sure to use both Happy- and Sad-Path tests
  • 39. copyright © 2021 by amundsen.com, inc. -- all rights reserved Automate Testing with Newman CLI ● Newman is the Postman CLI client ● Automate testing using test-run.sh ● Optionally, use -r htmlextra option for HTML output
  • 40. copyright © 2021 by amundsen.com, inc. -- all rights reserved That's all there is!
  • 41. copyright © 2021 by amundsen.com, inc. -- all rights reserved Resources ● "Design and Build Great Web APIs" g.mamund.com/greatwebapis ● This talk (slides, links, etc.) g.mamund.com/2021-02-postman-galaxy-testing
  • 42. copyright © 2021 by amundsen.com, inc. -- all rights reserved Testing your APIs with Postman and Newman Mike Amundsen @mamund youtube.com/mamund