DevOps Automation

 View Only

API Virtualization The benefits of service virtualization in an API-driven development approach using IBM DevOps Test

By Muriel VIALE posted Mon January 22, 2024 01:26 AM


API Virtualization

The benefits of service virtualization in an API-driven development approach using IBM DevOps Test.

What Is an API-driven Approach?

The API-driven strategy emphasizes the use of APIs as the primary channel of communication between micro-services by thinking, defining, and standardizing the API definition first. In this approach, the whole system could be designed without thinking about the implementation, simply by adding an abstract layer.

The API-driven approach offers many benefits, which create a more reliable system, and a more predictable development experience as it reduces duplication, simplifies validation, helps creating built-in documentation, and avoids inconsistency.

In short, API-driven development is the practice of designing and building APIs first, then creating the rest of an application around them. In this way, API-driven development is different from traditional development strategies.

What is Service Virtualization ?

Service virtualization involves developing and deploying a “virtual asset” that mimics the behavior of a real service that is required to exercise the application under test but is difficult or impossible to access in a development or in a test environment.

A virtual asset acts as a stand-in for a dependent component by listening for requests and responding appropriately—with appropriate performance.

In the case of a database, this could entail listening for a SQL statement and then returning data source rows. A web service might do this by listening for an XML message over HTTP, JMS, or MQ and then returning another XML message.

The functionality and performance of the virtual asset may also reflect the actual functionality and performance of the real component, or it may simulate unusual conditions (such as extreme loads or error conditions) to decide how the application under test responds under those conditions.

What is API Virtualization ?

API virtualization is a natural extension of API driven development.

It provides the means for developing unit tests for API and instituting continuous testing for services and microservices as they are created.

As part of the development process, API developers or quality assurance engineers can configure endpoints in the service virtualization platform that simulate the API’s responses. All the other developers can then use these endpoints when building downstream apps and services.

API virtualization allows developers to start testing their API early in the process, before the user interface is even ready, and kill bugs before they become serious problems down the line.

What is IBM DevOps Test ?

IBM DevOps Test is a collection of continuous testing offerings for automated test creation, execution, virtualization, and analysis.

IBM DevOps Test Hub is a web-based continuous testing platform where you can run API, functional, performance tests and virtual services, all within a single tool.

IBM DevOps Test Integrations and APIs is a scripting-free environment for developing integration tests for API endpoints and creating virtual services for API endpoints. Tests and virtual services are built by recording existing system behaviors or from API definition.

IBM DevOps Test is very robust platform that can be used in the context of API Virtualization, to simulate APIs or other components using virtualization even if they are not built or available.

It is as simple as importing the API definitions and use the powerful wizard to get started and create virtualized APIs. No deep technical knowledge or coding experience is required.

The full version of an API can be virtualized into the IBM DevOps Test platform before the application is even built and start testing and developing in parallel well before your actual API is delivered.

Using IBM DevOps Test Integration and APIs to virtualize an API , example based on a swagger definition

As an example, based on a Swagger definition imported in IBM DevOps Test Integration and APIs, we can see how quickly it is to create a virtual API based on the structure of the schema that is defined for the operation and have the response payload populated with data.

To do this, simply point to the URL or import the swagger file into an existing project, to load the API definition into the tool:

Then create the virtual API endpoint using the wizard:

Result is a virtual API service endpoint with the response payload populated with data, ready to be used:


Even if components aren’t available, test anyway:

When key components are unavailable, testing is delayed and complicated. Being able to test early in the lifecycle helps ensure quality and reduce the cost of bug fixes.

API virtualization eliminates dependencies, allowing to concentrate on testing.

Demonstrate the Concept Before You Build

API virtualization also enables you to create proof of concepts before developing a product. You can simulate services built with specific APIs to determine whether it is a product worth developing.

This saves money and time while also allowing for rapid, agile, iterative feedback at critical stages of development.