Original Article by TechSling Weblog:
In the parlance of an Application Program Interface (API), it’s common to encounter terms like Api Mocking and API virtualization. Those not immediately familiar with the language may be intimidated by the two, or they may lack the awareness that these two terms refer to completely different stages in API testing.
But what everyone should know about APIs—be they the front- or back-end developers or regular end users who access the API’s functions on their smartphones—is that testing takes time, resources, and the repeated engagement of numerous software components. It is impossible to construct a copy of an API in one go, with all parts at full functionality. In order to achieve a full simulation close to what will be released on the API market, developers have to undergo several disparate stages of testing.
This feature aims to introduce the concept of API mocking, its distinction from API virtualization, and wherein the scheme of API testing these two stages fall.
API Mocking and API Visualization: The Toppings versus the Whole Pie
Perhaps API mocking and API virtualization are best differentiated by what they are meant to achieve in the testing stage. Mocking involves the creation of an imitation software component (on the level of coding, infrastructure, service, or others) that is meant to elicit a singular behavioral response necessary for a certain time or certain developmental need. A mock can be repeated as many times as the creator wishes until it fulfills its outcome—which, in most cases, relates to garnering feedback from manual or automated tests, as well as diagnosing bugs.
Virtualization, on the other hand, is the stage in which developers create a full virtual copy of the API. This copy is made to mirror all the specifications of production, and it is capable of emulating the behaviors an operational API would be able to execute. At the virtualization stage, it is assumed that developers have worked out all the basic kinks and are now sharpening the product for a timely release into the market.
To summarize: mock functions only for the specific behavior and context it is made for, while the virtualization assumes all of the behaviors that a full working copy of the API is expected to have. You can think of the two as the toppings on a pizza and the whole pie, respectively—mocks are like individual pizza toppings that you are testing and configuring for the ideal flavor of the pie, while the virtualization is your full picture of the pie before it comes out of the oven, ready to consume.
Steps to Testing an API and Making Its Launch a Reality
In the grand scheme of API testing, the creation of API mocks precedes the running of API virtualization. But these are by no means the only methods executed during API testing; they are only two out of four steps that are typically required for API simulation.
The first stage is called the stubbing stage, in which developers tinker with stubs, or placeholder virtual parts, that do not have real functionality on their own. Next, they move on to the mocking stage where they create mocks and execute functions in a particular context. The third stage is the simulation stage, wherein developers assemble virtual parts that do have complete functionality. Last in this race to make an API a real, moving product is the virtualization stage, where developers can see the behaviors of more than one API endpoint.
Once all stages in this creation strategy are completed, then a new API may make its way into the world. A digital product that makes our daily interactions via smartphone, tablet, or laptop seems so seamless is, nonetheless, the result of trial, error, and a whole lot of hard work.
The post Understanding the Difference between API Mocking and Visualization first appeared on TechSling Weblog.
This post first appeared on TechSling Weblog - Digital News, Information & Resources, please read the originial post: here