Service Virtualization 101

A Guide to the Benefits and Use Cases to Help Your Team Deliver Quality Applications, Faster

Learn more about ReadyAPI

Introduction

High Quality. Fast. Cheap. Safe. In the ideal scenario, development, testing, and operations teams work harmoniously to deliver high quality applications on schedule, under budget, and error free. But as applications become more complex, and companies adopt Agile method (characterized by short-cycles, and iterative sprints), maintaining these ideals become increasingly difficult. Service Virtualization provides opportunities for both developers and testers to ensure high quality throughout the entire software development life cycle.

What is Service Virtualization?

Service Virtualization mimics or simulates behaviors of components that are unavailable or difficult to access while testing – similar to how pilots use a flight simulator to train instead of a real plane, or a boxer uses a punching bag to train instead of a real fighter. Such components can include devices, databases, APIs, networks, and more. There can be many reasons why resources might be unavailable or difficult to access: components may still be under development, undergoing maintenance, difficult to set up, owned by third parties, costly or restricted. Through virtualization, testers are no longer dependent on these assets, or blocked by other teams and can continuously conduct integrated testing at any point of the software development lifecycle. This allows for more in-depth performance and functional testing that can be done in parallel.

What are the benefits of Service Virtualization?

Service Virtualization removes dependencies and associated headaches which in turn reduces time to market, costs, and allows team to deliver high quality features.

Benefit 1: Reduce Dependencies & Headaches:

Dependencies may come in two forms: internal dependencies in which testing cannot proceed if a component is not fully developed, or external dependencies in which a third-party component outside of your control may not be available yet or may have limited amount of third-party calls. Service Virtualization can simulate these specific components so you are no longer dependent on these other components or have to worry about throttling (which limits how many times you can access a service), or costs associated with third party components. Strong virtualization tools allow you to quickly spin up a service to interact and test with. Typically, there is a large overhead involved in coordinating with separate team just to create a virtual system. Because these types of dependencies are avoided, teams can work in parallel, which saves time and money.

Benefit 2: Reduce Time to Market:

Software Development Life Cycle may involve a lot of waiting – an app developer may wait for internal colleagues or a third-party to release API, an API developer may be waiting for a fellow integrator release, or a tester may be waiting for a final piece of code. By simulating components through virtualization, teams can move faster, work in parallel and conduct load and risk tests leading to greater productivity. Virtualization also allows organizations to bring internal and external beta testers before the application or API is ready. Many virtualization tools will also allow developers to switch between a virtual environment and the real asset – otherwise this requires lengthy rebuild of the application. This reduces time to market.

Benefit 3: Increase Quality:

Service Virtualization allows you to have deeper control of your testing environment. In order to thoroughly evaluate an application, it must be tested under a variety of conditions. Virtualization allows you to very quickly spin up a service/API and conduct different tests such as: load tests, performance tests, functional tests. These types of tests can be done early in the development lifecycle, and not blocked by other functions. By being able to replicate what a service does within an environment, developers can understand how it will interact with other parts of the system then design for those needs while testers can simultaneously test. This in turn increases productivity, reduces risk and allows teams to flag issues early in the process.

Benefit 4: Reduce Costs:

Service virtualization reduces costs such as services charges to a third-party API, database or service. By mocking or mimicking how the service acts in the development and production stages you can bypass these associated costs and work efficiently. Secondly, service virtualization reduces infrastructure costs and operating expenses as less money is needed for accessing, recovering, and reusing what is in the cloud. Finally, there are labor costs associated with idle time are saved.

What is API Virtualization?

Application Programming Interfaces (APIs) are allowing applications to unlock new capabilities, business and revenue stream opportunities. APIs specify how software components should interact and communicate. A strong API provides the building blocks and foundation atop which a developer can build an application an enable third-party applications to leverage an external organization’s data securely. An example of this is the ride-sharing company Lyft which leverages the Google Maps API as their maps infrastructure. Using the API prevents Lyft from having to build out a whole mapping infrastructure from scratch and allows them to focus on their core value proposition. On the other hand, this also creates a new revenue source for Google.  API virtualization specifically concentrates on the API level of your technology stack.

An API virtualization tool can create an exact virtual copy of your API or the one that you are integrating with. When you’re doing testing, the API may be unavailable, or expensive; instead of hitting the real service, you can simulate responses or play with your API in a virtual environment / sandbox that simulates your production environment, but does not disrupt it. It also means that you don’t have to set up a separate server stack to mimic your production environment — with API virtualization, you can simulate the behavior of your API(s). This means you can test out your API to see how it’s integrating with others before it’s even ready. API virtualization allows you to test your API early and often and it allows you to do so separately from all the dependencies you have around your company and to other APIs. The result? Soon after your API is built, it’s already been tested and is strong, secure, stable and ready to go.

API virtualization tools are significantly cheaper than enterprise-grade complete virtualization systems which could cost upwards to $200,000 a year. This includes enterprise-level subscription fees, training, and implementation costs.

What is API Mocking?

Before diving into the use cases for API Virtualization, it is important to understand what “mocks” are and how virtualization differs. Mocks are imitation software components used by developers to emulate real software components for testing purposes. Mocking functions tend to be context-specific, simulating behavioral response to fulfill a certain development need. API mocking allows for isolating a specific piece from the rest of the application.

Mocking is very simplistic and ultimately wastes a lot of time. Developers must go through complicated act of creating new interfaces, and other superfluous work. API virtualization on the other hand is much more flexible, reusable, and can be used throughout production and testing environments. Furthermore, API virtualization can be automated and forgoes the need of making individual classes, or testing scripts. API virtualization provides a much more realistic, full function simulated environment that’s far more robust than simple mocking.

Use Cases for API Virtualization

There can be a wide array of use cases for service virtualization – we have, at a high level, touched upon some of them previously. The strongest API virtualization tools help conduct different types of testing, increases quality and increases speed

Use Cases Where API Virtualization Helps Testing to Ensure High Quality:

API Performance Testing & Third Party Sandboxing

Performance testing helps understand the full capabilities of the API under an array of conditions. Understanding how an API behaves under delays, high traffic scenarios, and more provide key insights on the user experience. Again, API requests could cost money or be unavailable, making it difficult for testers to evaluate specific conditions. With API virtualization, you can model these APIs and run these tests from the very beginning of the software development life-cycle. Through virtualization you have greater, more granular control of your API conditions to create more advanced tests. This gives greater peace of mind that all scenarios are covered.

Example: A financial organization has a unique combination of financial products. To ensure test coverage, a lot of effort went into finding specific customers with the set of products needed to test each use-case. With a virtualization tool like ReadyAPI they can easily set up expected responses. They were able to easily configure “customers” with product mixes, edge case scenario responses, responses for negative tests, and one-off use case responses to ensure test coverage and quality.

API Load Testing

One key aspect of performance testing is load testing – understanding how your API performs under high traffic / load conditions. Many times, load testing happens at the point of release or even after application has been deployed which is too late. By using virtual environments, you can conduct various unique load testing scenarios. Some APIs may charge per call, or cannot handle a large volume of calls, so load testing in virtual environments can cheaply show how your application functions under heavy loads.

Long-term Automated Testing

Additionally, you can automate load testing so you can catch flaws in the code right when they appear. There are an abundance of different use cases and scenarios under which your API must perform. With mocking, you would have to build out each of these cases separately, however through virtualization, results from your load tests can be automated and can run (even after our API is released).

Automate Different Testing Scenarios in Various Message Types

Strong API virtualization tools help you create automated testing scenarios in various message types and protocols, including REST, JSON, WADL and JMS. It also allows for multilayer validation automation across multiple endpoints, for end-to-end testing. API Virtualization allows you to visualize how messages and events go through complex distributed architectures, then enables you to combine all these things into repeatable tests without dependencies on anything or anyone else. This greatly simplifies the testing process to ensure the application is performing the way it should be.

API Extreme Case Testing

If you want to create some obscure conditions to test the limits of your API, you can use service virtualization to set extreme conditions. This can range from poor connectivity to high call volumes to other conditions that are less predictable until your API is released into the wild. By using an API virtualization tool to make a complete replica of your API, you can then alter its environment to understand how it would behave under certain conditions.

Failure Case Testing

Understanding the user experience is extremely important – a poor user experience can lead to diminished brand equity and loss of potential profits. It is important to test how an application behaves when something fails but this can be difficult. An API virtualization tool can test against downtime, slow response time, if a downstream integration breaks down, and allows you to fail safely and make sure your error messages are accurate early in the development lifecycle. This can help you position yourself for success.

Security Testing

Security is also a vital part of an application and poor security may cause customers to distrust your organization. API security must be tested before release. API virtualization allows you to replicate all aspects of your environment, your API and what its integrating with to make sure all components are extremely secure.

Secure Training Simulations Example

One great example of a use case for a service virtualization solution like ReadyAPI comes from Zurich Insurance Group, a financial services company that has built an internal application that they use for training their employees. It involves weekly training on the financial applications that they sell, and they need to simulate account creation and moving money.

Zurich found that, with service virtualization, they could visualize access to all these systems, and can do training for their products without actually interacting with their systems. Previously, they had to reset and reconfigure the whole system, which was very costly and time-consuming. Now, with ReadyAPI service virtualization, they don’t even have to buy the hardware to configure it, set it up, and tear it down. By creating a safe environment in these very important systems with huge risk, it makes it very segmented from the rest, as, from a security perspective, they would never be able to run a training system on one of the real systems. This allows them to extend their functional testing and virtualize.

Read more about how the Zurich Insurance Group runs virtual training through service virtualization.

Test Even When Components Are Not Available

Testing gets delayed and complicated when key components are not available (internally or externally). Being able to test early in the life-cycle will help ensure quality and cheaply fix bugs. Through virtualization, you can simulate APIs or other components even if they are not built or available. API virtualization gets rid of dependencies allowing you to focus on testing. Additionally, there may be times when parts of an API may be available and there is a need to switch from a virtual environment to the actual endpoint. Many tools help change the routing configuration without having to change the application altogether.

Example: In Capital One, when real APIs are available, a redeployment of the firmware was required and changes found during testing would require that the firmware be reverted back. The rollout and roll back of the firmware cost 3 hours of lost productivity and variability. Service V routing feature enabled them to change the route between the real API and the virtualized API without firmware changes.

Prove The Concept Before Actually Building

API virtualization also allows you to create proof of concepts even before building out a product. You can simulate services built of particular APIs and gauge whether it is a product worth building. This can save time, money, and allows for rapid, agile, iterative feedback at important stages of development. In the end service virtualization helps build richer products that customers and partners want.

Find the Best API to Integrate with

If you are a Software as a Service (SaaS) it is common to integrate with different tools through strategic partnerships. It may be difficult and expensive to integrate with many tools at once. API Virtualization can create different scenarios where you can try different integration points. This helps with prioritization and helps find the right integration partner to enhance the quality of the product. Additionally, this can save time and money and prevent you from investing in a poorly paired partnership.

Use Cases Where Service Virtualization Increases Speed:

Easier Coordination - Reduce Time to Test For Microservices

Microservices are another popular circumstance where you have small components independently released, changed and redeployed at any given time. They are an important part of continuous deployment, but make it difficult to test for continuous integration, as each service can come from any variety of locations and dissimilar environments. While developers gain more and more independence, there needs to be some sort of coordination throughout, which means continuous, automated testing. Often this means having to deploy all the microservices within an organization when running tests for a new API. With API virtualization, developers can install just the one microservice they are working on and then virtualize the others through virtual instances. It can cut testing microservices down from a day to just a few hours.

Reduce Dependencies and Have QA Involved at The Beginning

“Shifting Right” styled processes have QA involved in testing from the start, offering feedback to developers. API virtualization allows QA to dive in and test works in progress in an exact copy of the environment, without the developers having to release their features.

Enhance Continuous CI/CD Testing

Fortune 500 companies can have hundreds of Scrum teams working asynchronously — imagine all those dependencies! If you working in a continuous integration and continuous deployment and delivery company, how in the world can you test continually? Well, a lot of the time, that part is ignored or forgotten because of the dependencies.

To prepare a truly secure, bug-free release, you need continuous testing or the execution of automated tests as part of the software delivery pipeline for immediate feedback. Simply making sure everything works isn’t enough. You’ll also need to ensure that you’re meeting system requirements and larger business goals, and, of course, making sure all your integrations are stable and continuous. API virtualization enables this, by empowering QA to test even while the API is still being developed. It also allows app testers to make sure they can integrate properly with a third-party API, even when that app is far from ready for release.

Enhance DevOps Transformation

In order for you to achieve continuous integration and delivery (CI/CD), you need to automate at least 80 percent of your testing. API testing is particularly important here because it helps assure that, as you add new features, your whole integration pipeline — made up of both internal and external APIs — still works. As the lines blur between development and operations and everyone becomes more agile, releases and feedback loops are much more frequent. However, these teams often run UI-only test suites, which these feedback cycles often break. API virtualization allows you to simulate dependencies earlier so you can set up automated testing as you go.

Iteratively Design

If you have an iterative design environment, you can virtualize the API as a way to quickly try out new things, without creating the full API. This is a very agile way to try new features and partnerships without heavily investing in them.

Accelerate User Interface Testing

Service virtualization tools like SmartBear ReadyAPI enable you to describe common UI integrations via Web services like AJAX and SOA. This helps with you perform UI testing, anytime, anywhere without interruptions. You can emulate external environments which lets you gain more control over the data returned via Web services. And, of course, you can develop and test the UI integrations even before those Web services are available.

Data virtualization

For an enormous enterprise, there are countless uses for virtualization. But these increased use cases mean a substantial increase in cost. For most teams, there are only two service virtualization use cases that matter — API virtualization, which we’ve talked a lot about, and data virtualization. But, like with APIs, much of that data we are accessing today is from third parties. And, of course, this brings with it all the problems of more dependencies.

Database provisioning and maintenance can quickly become a bottleneck (as database admins are often untrained in our new cloud-based world and lack the skills to effectively and efficiently migrate data). Database virtualization services or DVS allow you to decouple the database layer, enabling organizations to pool and allocate database resources on demand.

With DVS, you can keep building and keep testing against real-world data examples, even when your data sources are unavailable. Once you've identified the data source, you simply specify the properties those data sources include. When requests are passed to your virtualization tool, a DVS can use this data source to generate appropriate context-specific responses based on the request parameters. As you modify those data sets, the simulated responses will update automatically.

With ReadyAPI, you can use any of the following data source formats:

  • A database
  • JDBC or Java database connectivity
  • A delimited file
  • Excel or XML file
  • A simple grid

Like all things virtualized, data virtualization decreases the friction of dependencies that slows you down. You can just keep moving ahead, even when your data sources remain on-premise. You can even use a virtual database to migrate from one physical server to another without any interruptions, which is a way to save on huge infrastructure costs often incurred from more traditional database management. By being able to record and replay JDBC transactions, you can continue development and testing even when your database — or the database you’re connecting to — is unavailable.

Service virtualization gets results

Gartner recently surveyed organizations with more than 500 employees who were using service virtualization. They discovered that companies using S.V. were achieving greater software quality, in less time, with less costs. They found that:

  • More than a quarter of the organizations doubled their test execution rates.
  • More than a third cut their test cycle times in half.
  • Almost half saw a 40 percent reduction in defects.

When you cut costs, cut time to market, and cut dependencies, you increase your business value. Service virtualization accomplishes all this and more. So what are you waiting for?

More Service Virtualization Resources:

Or just contact us today to learn more about ReadyAPI!