API testing involves testing APIs directly (in isolation) and as part of the end-to-end transactions exercised during integration testing.5 Beyond RESTful APIs, these transactions include multiple types of endpoints such as web services, ESBs, databases, mainframes, web UIs, and ERPs. API testing is performed on APIs that the development team produces as well as APIs that the team consumes within their application (including third-party APIs).6
API testing is used to determine whether APIs return the correct response (in the expected format) for a broad range of feasible requests, react properly to edge cases such as failures and unexpected/extreme inputs, deliver responses in an acceptable amount of time, and respond securely to potential security attacks.78 Service virtualization is used in conjunction with API testing to isolate the services under test as well as expand test environment access by simulating APIs/services that are not accessible for testing.9
API testing commonly includes testing REST APIs or SOAP web services with JSON or XML message payloads being sent over HTTP, HTTPS, JMS, and MQ.1011 It can also include message formats such as SWIFT, FIX, EDI and similar fixed-length formats, CSV, ISO 8583 and Protocol Buffers being sent over transports/protocols such as TCP/IP, ISO 8583, MQTT, FIX, RMI, SMTP, TIBCO Rendezvous, and FIX.1213
API Testing is recognised as being more suitable for test automation and continuous testing (especially the automation used with Agile software development and DevOps) than GUI testing.1415 Reasons cited include:
For these reasons, it is recommended that teams increase their level of API testing while decreasing their reliance on GUI testing. API testing is recommended for the vast majority of test automation efforts and as much edge testing as possible. GUI testing is then reserved for validating typical use cases at the system level, mobile testing, and usability testing.161718
There are several types of tests that can be performed on APIs. Some of these include smoke testing, functional testing, security testing, penetration testing, and validation testing.
Testing APIs protects applications and reputations, by Amy Reichert, SearchSoftwareQuality March 2015 http://searchsoftwarequality.techtarget.com/tip/Testing-APIs-protects-applications-and-reputations ↩
All About API Testing: An Interview with Jonathan Cooper, by Cameron Philipp-Edmonds, Stickyminds August 19, 2014 http://www.stickyminds.com/interview/all-about-api-testing-interview-jonathan-cooper ↩
The Forrester Wave Evaluation Of Functional Test Automation (FTA) Is Out And It's All About Going Beyond GUI Testing Archived 2015-05-28 at the Wayback Machine, by Diego Lo Giudice, Forrester April 23, 2015 http://blogs.forrester.com/diego_lo_giudice/15-04-23-the_forrester_wave_evaluation_of_functional_test_automation_fta_is_out_and_its_all_about_going_be?cm_mmc=RSS-_-BT-_-63-_-blog_1769 ↩
Produce Better Software by Using a Layered Testing Strategy, by SEAN Kenefick, Gartner January 7, 2014 https://www.gartner.com/en/documents/2645817 ↩
Onus for third-party APIs is on enterprise developers Archived 2019-07-31 at the Wayback Machine, by Amy Reichert, SearchSoftwareQuality July 2014 http://searchsoftwarequality.techtarget.com/tip/Onus-for-third-party-APIs-is-on-enterprise-developers ↩
Accelerate Development with Automated Testing[dead link], by Nathan Wilson, Gartner December 30, 2013 http://www.gartner.com/document/2642716 ↩
A Guidance Framework for Designing a Great Web API[dead link], by Eric Knipp and Gary Olliffe, Gartner August 20, 2014 http://www.gartner.com/document/2827918 ↩
The Fight Against Brittle Scripts and Software Defects, by Adrian Bridgwater, Dr. Dobb's Journal October 26, 2011 http://www.drdobbs.com/tools/the-fight-against-brittle-scripts-and-so/231901658 ↩
How Do We Learn Composite App Testing-Speak?, by Adrian Bridgwater, Dr. Dobb's Journal February 14, 2012 http://www.drdobbs.com/testing/how-do-we-learn-composite-app-testing-sp/232600874 ↩
Cohn, Mike (2009). Succeeding with Agile: Software Development Using Scrum. Addison-Wesley Professional. p. 312. ISBN 978-0321579362. 978-0321579362 ↩
J. Gao, C. Tao, D. Jie ĺ, S. Lu (2019). What is AI Software Testing? and Why. IEEE. pp. 27–2709. doi:10.1109/SOSE.2019.00015.{{cite book}}: CS1 maint: multiple names: authors list (link) https://ieeexplore.ieee.org/document/8705808/authors#authors ↩