''AAA'' API Testing - Accessible, Affordable, Agile
''AAA'' API Testing - Accessible, Affordable, Agile
How Service Virtualization addresses the growing challenge of testing third-party APIs.
Join the DZone community and get the full member experience.Join For Free
APIs are at the core of today’s digital economy and have become boardroom-level topics of discussion. And with third-party APIs now being used by core systems, it’s more critical than ever for data to be secured and systems to be well tested. This is hard enough to do when working with an internal API, let alone when integrating an API from a third party, which companies like Jet.com have painfully realized. Michael Joseph sums up the challenges up of testing third-party APIs very well:
Verifying integration with third-party services is a pain in your wallet. Those services, which are vital to your success but not under your control, are difficult and expensive to access, they change without notice, and you don’t control their performance.
This is further reinforced in the Voke Market Snapshot on Service Virtualization in which 79% of participants reported third-party restrictions, time limits, or fees for the services or applications they needed for development and testing. In addition, API access and fees vary greatly by provider. Understanding contract terms and associated fees can be complicated which can make estimating costs associated with development and testing difficult.
If that’s not enough, there is the challenge of all the dependencies that come along with APIs. How do you even know where all of the dependencies are? How do you test all the dependencies? Tested alone an API may work fine. But once deployed it may no longer work or it may work poorly due to a related API that is slow, broken, or missing.
Enter API Testing from CA Technologies
CA Service Virtualization offers a solution to many of the challenges associated with third-party API testing. It won’t prevent things like outages or changes made by the provider but it can make the API accessible and affordable to test so that you can support agile testing and development.
Service Virtualization is used to simulate the APIs, data and dependencies so that integration and performance testing can take place earlier in the software development lifecycle. By creating a simulation of the API that behaves just like the real one, you can test whenever you want and as much as you want.
In addition to providing an automated solution for generating virtualized APIs it offers advantages over other testing methods (like wrappers, mocks, or stubs) by being able to effectively execute and handle:
- Race conditions – system delays, time outs or things happening too fast
- Errors coming from the target
- Data collisions and conflicts
- Tests that rely on previous data population
The Voke report addresses this further stating that “stubbing and mocking can create quality problems in the underlying software. The reason: Stubs and mocks may not be an accurate reflection of the complete or final behavior of the dependent resource. That, in turn, can create a cascading set of problems, from introducing unnecessary and undetectable defects to functionality failures and increased costs to rework the code.”
How Does Service Virtualization Do It?
Service Virtualization captures the needed information to use code contracts like WSDLS, or it can use Request and Response pairs. To create the services it focuses on capturing the protocols. Virtual Services have 2 layers of protocols – transport protocols for handling things on the wire and supporting TCP, HTTP, MQ, JMS, etc., and data protocols that interpret message formats such as SOAP, REST, JSON, etc. You can mix and match those as needed to support a third-party API. Most third party APIs will conform to one or more of these standards and can be virtualized out of the box.
The virtualized API can then be deployed in various Virtual Service Environments (VSEs) so developers and testers have everything they need when they need it. Virtualized APIs can also be deployed across the entire production cycle. Developers can leverage for unit tests, QA can then leverage for functional, integration, regression and performance teats. Automated tests can be created and run as part a continuous integration cycle.
The ability to switch between live and virtual services also plays into what we call image validation. Sometimes live services change. It is important to periodically look at the comparison of what you see when you run a test against a virtual service vs. a live service to see what has changed over time. This way we you know how services evolve. Our API Management solutions can also help you accomplish this. All of our virtualized services can be built to know where the live services sit.
And that’s just the beginning. There are many more advantages to using Service Virtualization. Learn more by listening to our recently recorded webcast “Accessible and Affordable 3rd Party API and Microservice Integration Testing” or browsing thru the articles on www.servicevirtualization.com.
Published at DZone with permission of Heather Peyton , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.