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

More Related Content

What's hot

Postman
PostmanPostman
API Testing for everyone.pptx
API Testing for everyone.pptxAPI Testing for everyone.pptx
API Testing for everyone.pptx
Pricilla Bilavendran
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
SQALab
 
Postman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman & API Testing by Amber Race
Postman & API Testing by Amber Race
Postman
 
RESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and JenkinsRESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and Jenkins
QASymphony
 
B4USolution_API-Testing
B4USolution_API-TestingB4USolution_API-Testing
B4USolution_API-Testing
b4usolution .
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
ParrotBAD
 
Postman 101 & Office Hours
Postman 101 & Office HoursPostman 101 & Office Hours
Postman 101 & Office Hours
Postman
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
Postman
 
Api Testing
Api TestingApi Testing
Api Testing
Vishwanath KC
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
Andrey Oleynik
 
Advanced API Debugging
Advanced API DebuggingAdvanced API Debugging
Advanced API Debugging
Postman
 
Api testing
Api testingApi testing
Api testing
HamzaMajid13
 
Postman 101 for Students
Postman 101 for StudentsPostman 101 for Students
Postman 101 for Students
Postman
 
API Testing Presentations.pptx
API Testing Presentations.pptxAPI Testing Presentations.pptx
API Testing Presentations.pptx
ManmitSalunke
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
Postman
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
TEST Huddle
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
Mithilesh Singh
 
OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdf
Postman
 
Testing your APIs Performance.pptx
Testing your APIs Performance.pptxTesting your APIs Performance.pptx
Testing your APIs Performance.pptx
Pricilla Bilavendran
 

What's hot (20)

Postman
PostmanPostman
Postman
 
API Testing for everyone.pptx
API Testing for everyone.pptxAPI Testing for everyone.pptx
API Testing for everyone.pptx
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
 
Postman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman & API Testing by Amber Race
Postman & API Testing by Amber Race
 
RESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and JenkinsRESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and Jenkins
 
B4USolution_API-Testing
B4USolution_API-TestingB4USolution_API-Testing
B4USolution_API-Testing
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
Postman 101 & Office Hours
Postman 101 & Office HoursPostman 101 & Office Hours
Postman 101 & Office Hours
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
 
Api Testing
Api TestingApi Testing
Api Testing
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
Advanced API Debugging
Advanced API DebuggingAdvanced API Debugging
Advanced API Debugging
 
Api testing
Api testingApi testing
Api testing
 
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
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
 
OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdf
 
Testing your APIs Performance.pptx
Testing your APIs Performance.pptxTesting your APIs Performance.pptx
Testing your APIs Performance.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 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
 
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
Amazon 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 Fargate
Amazon 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 2018
Amazon 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 Amundsen
apidays
 
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
Amazon Web Services
 
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
 
Deep Dive into Amazon Fargate
Deep Dive into Amazon FargateDeep Dive into Amazon Fargate
Deep Dive into Amazon Fargate
Amazon Web Services
 
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
Amazon Web Services
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s Story
Amazon Web Services
 
Aarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinarAarna networks debugging oom failures webinar
Aarna networks debugging oom failures webinar
aarnanetworks
 
CI/CD@Scale
CI/CD@ScaleCI/CD@Scale
CI/CD@Scale
Amazon Web Services
 
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
 
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
 

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

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
 
Introduction to API Security - Intergalactic
Introduction to API Security - IntergalacticIntroduction to API Security - Intergalactic
Introduction to API Security - Intergalactic
Postman
 

More from Postman (20)

WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
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
 

Recently uploaded

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 

Recently uploaded (20)

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 

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