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

More Related Content

What's hot (20)

POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
Postman
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman Introduction
Rahul Agarwal
 
Postman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman & API Testing by Amber Race
Postman & API Testing by Amber Race
Postman
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
ParrotBAD
 
Space Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdfSpace Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdf
Postman
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
Postman
 
Postman 101 & Office Hours
Postman 101 & Office HoursPostman 101 & Office Hours
Postman 101 & Office Hours
Postman
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
SQALab
 
Postman Webinar: Postman 101
Postman Webinar: Postman 101Postman Webinar: Postman 101
Postman Webinar: Postman 101
Nikita Sharma
 
Rest assured
Rest assuredRest assured
Rest assured
Varun Deshpande
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
Mithilesh Singh
 
Postman
PostmanPostman
Postman
Igor Shubovych
 
Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”
Postman
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
Bruno Pedro
 
API Testing
API TestingAPI Testing
API Testing
Bikash Sharma
 
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
 
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
 
Postman. From simple API test to end to end scenario
Postman. From simple API test to end to end scenarioPostman. From simple API test to end to end scenario
Postman. From simple API test to end to end scenario
HYS Enterprise
 
Continuous Quality with Postman
Continuous Quality with PostmanContinuous Quality with Postman
Continuous Quality with Postman
Postman
 
Postman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptxPostman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptx
Postman
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
Postman
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman Introduction
Rahul Agarwal
 
Postman & API Testing by Amber Race
Postman & API Testing by Amber RacePostman & API Testing by Amber Race
Postman & API Testing by Amber Race
Postman
 
Space Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdfSpace Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdf
Postman
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
Postman
 
Postman 101 & Office Hours
Postman 101 & Office HoursPostman 101 & Office Hours
Postman 101 & Office Hours
Postman
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
SQALab
 
Postman Webinar: Postman 101
Postman Webinar: Postman 101Postman Webinar: Postman 101
Postman Webinar: Postman 101
Nikita Sharma
 
API_Testing_with_Postman
API_Testing_with_PostmanAPI_Testing_with_Postman
API_Testing_with_Postman
Mithilesh Singh
 
Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”
Postman
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
Bruno Pedro
 
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
 
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
 
Postman. From simple API test to end to end scenario
Postman. From simple API test to end to end scenarioPostman. From simple API test to end to end scenario
Postman. From simple API test to end to end scenario
HYS Enterprise
 
Continuous Quality with Postman
Continuous Quality with PostmanContinuous Quality with Postman
Continuous Quality with Postman
Postman
 
Postman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptxPostman An Introduction for Testers, October 26 2022.pptx
Postman An Introduction for Testers, October 26 2022.pptx
Postman
 

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

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

More from Postman (20)

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

Recently uploaded (20)

Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Solar-wind hybrid engery a system sustainable power
Solar-wind  hybrid engery a system sustainable powerSolar-wind  hybrid engery a system sustainable power
Solar-wind hybrid engery a system sustainable power
bhoomigowda12345
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
AEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural MeetingAEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural Meeting
jennaf3
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
Buy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training techBuy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training tech
Rustici Software
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Adobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREEAdobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREE
zafranwaqar90
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Do not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your causeDo not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your cause
Fexle Services Pvt. Ltd.
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Solar-wind hybrid engery a system sustainable power
Solar-wind  hybrid engery a system sustainable powerSolar-wind  hybrid engery a system sustainable power
Solar-wind hybrid engery a system sustainable power
bhoomigowda12345
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
AEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural MeetingAEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural Meeting
jennaf3
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
Buy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training techBuy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training tech
Rustici Software
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Adobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREEAdobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREE
zafranwaqar90
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Do not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your causeDo not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your cause
Fexle Services Pvt. Ltd.
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 

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
  翻译: