SlideShare a Scribd company logo
1 of 42
Download to read offline
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

More Related Content

What's hot

OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfPostman
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API TestingSauce Labs
 
Postman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman
 
Space Camp - API Contract Testing
Space Camp - API Contract TestingSpace Camp - API Contract Testing
Space Camp - API Contract TestingPostman
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_PostmanMithilesh Singh
 
Postman 101 for Students
Postman 101 for StudentsPostman 101 for Students
Postman 101 for StudentsPostman
 
API Testing Presentations.pptx
API Testing Presentations.pptxAPI Testing Presentations.pptx
API Testing Presentations.pptxManmitSalunke
 
Continuous Quality with Postman
Continuous Quality with PostmanContinuous Quality with Postman
Continuous Quality with PostmanPostman
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for TestersPostman
 
Postman Webinar: "API Governance with Postman"
Postman Webinar: "API Governance with Postman"Postman Webinar: "API Governance with Postman"
Postman Webinar: "API Governance with Postman"Postman
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for TestersPostman
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman IntroductionRahul Agarwal
 
Automate REST API Testing
Automate REST API TestingAutomate REST API Testing
Automate REST API TestingTechWell
 
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 APIIvan Katunou
 
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.pptxPostman
 

What's hot (20)

API Testing for everyone.pptx
API Testing for everyone.pptxAPI Testing for everyone.pptx
API Testing for everyone.pptx
 
Api testing
Api testingApi testing
Api testing
 
OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdf
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 
Postman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman & API Testing by Amber Race
Postman & API Testing by Amber Race
 
Space Camp - API Contract Testing
Space Camp - API Contract TestingSpace Camp - API Contract Testing
Space Camp - API Contract Testing
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
 
Postman 101 for Students
Postman 101 for StudentsPostman 101 for Students
Postman 101 for Students
 
API Testing Presentations.pptx
API Testing Presentations.pptxAPI Testing Presentations.pptx
API Testing Presentations.pptx
 
Continuous Quality with Postman
Continuous Quality with PostmanContinuous Quality with Postman
Continuous Quality with Postman
 
API TESTING
API TESTINGAPI TESTING
API TESTING
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
 
Postman Webinar: "API Governance with Postman"
Postman Webinar: "API Governance with Postman"Postman Webinar: "API Governance with Postman"
Postman Webinar: "API Governance with Postman"
 
API Testing
API TestingAPI Testing
API Testing
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
 
Belajar Postman test runner
Belajar Postman test runnerBelajar Postman test runner
Belajar Postman test runner
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman Introduction
 
Automate REST API Testing
Automate REST API TestingAutomate REST API Testing
Automate REST API Testing
 
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
 
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
 

Similar to Testing Your APIs: Postman, Newman, and Beyond

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 Amundsenapidays
 
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 Amundsenapidays
 
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 APIsapidays
 
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_SingaporeCI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_SingaporeAmazon Web Services
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateAmazon Web Services
 
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018Amazon Web Services
 
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 Amundsenapidays
 
Building CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless ApplicationsBuilding CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless ApplicationsAmazon Web Services
 
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018Amazon 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.pptxGaurav Madaan
 
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Amazon Web Services
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryAmazon Web Services
 
Aarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinarAarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinaraarnanetworks
 
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 @deliverAgile2019ciberkleid
 
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
 
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 EasyAkamai Developers & Admins
 

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
 
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
 
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
 
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_SingaporeCI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
CI-CD with AWS Developer Tools and Fargate_AWSPSSummit_Singapore
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and Fargate
 
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
 
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
 
Building CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless ApplicationsBuilding CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless Applications
 
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
 
Abhay-Resume
Abhay-ResumeAbhay-Resume
Abhay-Resume
 
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
 
Deep Dive into Amazon Fargate
Deep Dive into Amazon FargateDeep Dive into Amazon Fargate
Deep Dive into Amazon Fargate
 
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s Story
 
Aarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinarAarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinar
 
CI/CD@Scale
CI/CD@ScaleCI/CD@Scale
CI/CD@Scale
 
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
 
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 ...
 
CI/CD using AWS developer tools
CI/CD using AWS developer toolsCI/CD using AWS developer tools
CI/CD using AWS developer tools
 
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
 

More from 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 & DocumentationPostman
 
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 PostmanPostman
 
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 CollaborationPostman
 
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 TechniquesPostman
 
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 PostmanPostman
 
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 SuccessPostman
 
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 PostmanPostman
 
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 AsyncAPIPostman
 
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 v3Postman
 
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 PostmanPostman
 
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 PopularityPostman
 
Exploring Postman’s VS Code Extension
Exploring Postman’s VS Code ExtensionExploring Postman’s VS Code Extension
Exploring Postman’s VS Code ExtensionPostman
 
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 TrendsPostman
 
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 APIsPostman
 
Testing and Developing GraphQL APIs
Testing and Developing GraphQL APIsTesting and Developing GraphQL APIs
Testing and Developing GraphQL APIsPostman
 
Introduction to API Security - Intergalactic
Introduction to API Security - IntergalacticIntroduction to API Security - Intergalactic
Introduction to API Security - IntergalacticPostman
 
Unboxing What's New in Postman Q2
Unboxing What's New in Postman Q2Unboxing What's New in Postman Q2
Unboxing What's New in Postman Q2Postman
 

More from Postman (20)

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
 
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
 
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
 
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
 
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)
 
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
 
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
 
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
 
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
 
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
 
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
 
Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs
 
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
 
Exploring Postman’s VS Code Extension
Exploring Postman’s VS Code ExtensionExploring Postman’s VS Code Extension
Exploring Postman’s VS Code Extension
 
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
 
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
 
Testing and Developing gRPC APIs
Testing and Developing gRPC APIsTesting and Developing gRPC APIs
Testing and Developing gRPC APIs
 
Testing and Developing GraphQL APIs
Testing and Developing GraphQL APIsTesting and Developing GraphQL APIs
Testing and Developing GraphQL APIs
 
Introduction to API Security - Intergalactic
Introduction to API Security - IntergalacticIntroduction to API Security - Intergalactic
Introduction to API Security - Intergalactic
 
Unboxing What's New in Postman Q2
Unboxing What's New in Postman Q2Unboxing What's New in Postman Q2
Unboxing What's New in Postman Q2
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

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