Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Bruno Pedro
January 2016
How to Automate
API Testing
Summary
• types of API testing

• functional testing

• API exploration
• writing and running tests locally

• automating ...
3 types of API Testing
• unit testing

• functional testing

• load testing
increased
complexity
Unit Testing
• part of the development process
• usually written by developers

• tests how local code integrates with the...
Unit Testing: mocking
• actual API response is saved locally
• test uses local copy of API response

• several tools for d...
Functional Testing
• part of the QA process
• a kind of black-box testing

• focused on response generation

• often execu...
Functional Testing: identification
• which API calls should be tested
• how are those calls used by the application

• what...
Functional Testing: input
• usually fake data
• information that resembles real usage
• often obtained by studying user in...
Functional Testing: output
• tests should be similar to unit tests
• but performed on real API calls
• additional output

...
Functional Testing: execution
• manual crafting
• manually triggered
• potentially executed periodically
• result flags CI ...
API Exploration
• starts in the product development phase
• part of the product definition

• confirmed in the development p...
API Exploration: questions
• why are you using the API
• what API calls are used

• how does the product integrate with th...
API Exploration: hands-on
• getting a list of all the relevant API calls
• obtaining authorization credentials if needed

...
API Exploration: hands-on
swagger.io getpostman.com
API Exploration: hands-on
API Exploration: hands-on
collections are a way to group API calls
Local Tests
• one-off testing

• batch testing

• easy to validate
• a way to discover unanticipated API responses
Local Tests: hands-on
written in javascript and executed locally
Local Tests: hands-on
Local Tests: hands-on
Automated Tests
• repeatable process

• periodic execution

• possibly flagging CI
• dedicated or SaaS solutions
Automated Tests: hands-on
newman
runscope.com
Automated Tests: hands-on
test scheduling using Runscope
Automated Tests: hands-on
test metrics provided by Runscope
Wrap up
• unit and functional API testing

• identification, input, output and execution

• API exploration and introductio...
API Testing Workflow
newman
runscope.comswagger.io postman
+
Sean O’Connor
Lead Engineer
It's great to see a tool like API Changelog
come along. (…) as an API provider, it's always
...
Upcoming SlideShare
Loading in …5
×

How to Automate API Testing

4,346 views

Published on

Talk given at Typeform for the Barcelona Bug busters meetup.

How to Automate API Testing guides you through a possible API Testing workflow for API Functional Testing exploring different tools and approaches.

Published in: Engineering

How to Automate API Testing

  1. 1. Bruno Pedro January 2016 How to Automate API Testing
  2. 2. Summary • types of API testing • functional testing • API exploration • writing and running tests locally • automating test execution
  3. 3. 3 types of API Testing • unit testing
 • functional testing
 • load testing increased complexity
  4. 4. Unit Testing • part of the development process • usually written by developers • tests how local code integrates with the API • focused on request and response handling • automated by a CI process
  5. 5. Unit Testing: mocking • actual API response is saved locally • test uses local copy of API response • several tools for different programming languages • VCR (Ruby) • nock (Node.js)
  6. 6. Functional Testing • part of the QA process • a kind of black-box testing • focused on response generation • often executed periodically • tests how the API behaves under a controlled input
  7. 7. Functional Testing: identification • which API calls should be tested • how are those calls used by the application • what should be tested • who should be notified if tests fail
  8. 8. Functional Testing: input • usually fake data • information that resembles real usage • often obtained by studying user input • updated often
  9. 9. Functional Testing: output • tests should be similar to unit tests • but performed on real API calls • additional output • response time • specific API responses during testing
  10. 10. Functional Testing: execution • manual crafting • manually triggered • potentially executed periodically • result flags CI process
  11. 11. API Exploration • starts in the product development phase • part of the product definition • confirmed in the development process • validated by QA
  12. 12. API Exploration: questions • why are you using the API • what API calls are used • how does the product integrate with the API • what happens if the API fails or is unresponsive
  13. 13. API Exploration: hands-on • getting a list of all the relevant API calls • obtaining authorization credentials if needed • preparing fake input data • exploring the API calls manually
  14. 14. API Exploration: hands-on swagger.io getpostman.com
  15. 15. API Exploration: hands-on
  16. 16. API Exploration: hands-on collections are a way to group API calls
  17. 17. Local Tests • one-off testing • batch testing • easy to validate • a way to discover unanticipated API responses
  18. 18. Local Tests: hands-on written in javascript and executed locally
  19. 19. Local Tests: hands-on
  20. 20. Local Tests: hands-on
  21. 21. Automated Tests • repeatable process • periodic execution • possibly flagging CI • dedicated or SaaS solutions
  22. 22. Automated Tests: hands-on newman runscope.com
  23. 23. Automated Tests: hands-on test scheduling using Runscope
  24. 24. Automated Tests: hands-on test metrics provided by Runscope
  25. 25. Wrap up • unit and functional API testing • identification, input, output and execution • API exploration and introduction to Postman • local testing with Postman • automating tests with runscope
  26. 26. API Testing Workflow newman runscope.comswagger.io postman
  27. 27. + Sean O’Connor Lead Engineer It's great to see a tool like API Changelog come along. (…) as an API provider, it's always a challenge to communicate to users when changes happen. bpedro@apichangelog.com Get in touch! Bruno Pedro Thank you

×