API Test Automation by Joel Oliveira 17-18 November 2017 St. Petersburg
API?… 2
API? Application Programming Interface
API History 1960s APIs used as libraries in the first operating systems 1970s Distributed Systems - remote access to APIs 1990s Message Oriented Middleware Service Oriented Architecture SOAP – Simple Object Access Protocol 2000s REST – Representational state transfer or RESTful 2010s MicroServices 4
API Testing “A set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components.” 5 ISTQB Glossary http://glossary.istqb.org/search/API%20Testing
API Testing “Testing performed by submitting commands to the software under test using programming interfaces of the application directly.” 6 ISTQB Glossary http://glossary.istqb.org/search/API%20Testing
API Testing … today! “The majority of testers are responsible for both API and UI Testing” 7 The State of Testing 2017 - SmartBear https://smartbear.com/resources/ebooks/the-state-of-testing-2017-industry-report/
API Testing … tomorrow?  Agility  DevOps practices  Continuous Delivery > Continuous Deployment  Continuous Automated Testing  Test Automation and Shift left  Microservices Architecture migrations  Internet Of Things Exponential growth of available APIs! 8
API Testing … top concerns? 1. Functionality Is my API returning the correct response every time 2. Performance How the API responds under different load conditions 3. Security Is it safe from hackers and attacks 4. Availability Is always available to the users 9 The State of Testing 2017 - SmartBear https://smartbear.com/resources/ebooks/the-state-of-testing-2017-industry-report/
RESTful Web Services 10
RESTful Web Services Application Program Interface (API) Uses HTTP requests (POST, GET, PUT and DELETE) Based on representational state transfer technology No state is retained between calls (call are stateless) Lighter than the more robust SOAP JSON vs XML 11
RESTful Web Services - Constraints 1. Decouples consumers from producers 2. Stateless existence 3. Able to leverage a cache 4. Leverages a layered system 5. Leverages a uniform interface 12
RESTful Web Services - IoT JSON great for data interchange:  Schemaless (valid if is well-formed)  Minimal set of data types  Human-readable  Easily parseable  Parsers are widely available in different languages … but… 13
RESTful Web Services - IoT IoT devices typically need to optimize:  Network traffic (small and fast)  Amount of computation  Memory, storage and power consumption REST vs optimized IoT protocols… Solution? IoT hubs that act as man-in-the-middle 14
API Test Automation Tools 15
Some tools? Postman SoapUI Robot Framework
Disclaimer 17
A tool is just a tool! 18
Don’t use your hammer for everything! 19
Postman Developing APIs is hard Postman makes it easy Postman is the most complete API Development Environment https://www.getpostman.com 20
Postman https://www.getpostman.com/postman https://www.getpostman.com/pricing Header, Sidebar, Builder History & Collections (groups of requests) Runner, Newman or Monitors Environments Tests 21
SoapUI Build Better | Test Smarter The Most Advanced REST & SOAP Testing Tool in the World https://www.soapui.org 22
SoapUI https://www.soapui.org/open-source/features.html https://www.soapui.org/store.html Requests vs TestsCases SoapUI vs SoapUI PRO 23
Robot Framework Generic test automation framework for acceptance testing and ATDD http://robotframework.org 24
Robot Framework http://robotframework.org/#introduction https://github.com/joao-carloto/RF_Install_Script Framework vs Tool Keyword Driven Data Driven Requests library 25
https://www.linkedin.com/in/joeloliveira/ http://joel-oliveira.appspot.com/ oliveira.joel@outlook.com skype:o_joel @Joel_0liveira Thank You! Obrigado! Cпасибо! Questions?

API Test Automation

Editor's Notes

  • #2 In our days, it’s almost impossible to find a modern application that doesn’t provide or consumes an API in the form of a web service. With SOA or microservices, between layers or between server and client, internal or external services, SOAP or REST, IoT or web apps, no matter what, web service APIs are everywhere. Designed to allow a programmatic interaction between systems, APIs also need to be tested, and they are one of the first and natural candidates for test automation. In this workshop, we will go through 3 different tools to demonstrate how to do API Test Automation applying also different testing techniques (like Data-Driven Testing, Keyword-Driven Testing or Behaviour-Driven Testing).