ASTQ Summit is available on demand! Hear industry leaders share how they're delivering continuous quality. Watch Now >>

X

Test Continuously With Service Virtualization

The services your application calls might not be available for load testing when you need them. Service virtualization creates stable virtual services that replicate the real thing.

What Is Service Virtualization?

Service virtualization is a function of software testing that can emulate an application’s dependencies. It allows DevOps teams to use computer-generated virtual services in place of real ones so they can test often, test early, and lower costs in various situations. These include key parts of the distributed system that are missing: for example, when dependent components are inaccessible, scaling training environments, and building partner onboarding scenarios.

Using virtual services for testing purposes is more cost effective than using production environments for those purposes. API testing with endpoint simulation eliminates the chances of losing data, avoids using the expensive servers the actual program needs to operate and allows the company to forgo excess license fees. This results in fast, accurate, and less cumbersome testing procedures.

Integrate service virtualization into automated testing practices for the continuous integration testing that DevOps workflows demand.

The Benefits of Service Virtualization

To realize the benefits from Agile and DevOps initiatives, teams need instant access to their test environment, free of constraints. By applying service virtualization in testing environments, organizations can reduce or eliminate the dependence on unavailable, unstable, or costly dependencies, such as third-party services, databases, and mainframes.

Gain Access Any Time

Access the dependent services your application needs to interact with for accurate and thorough testing even if they are unavailable or incomplete at the time of testing.

Isolate Service Dependencies

When you can’t access the relevant service, its associated interdependencies are also a black box. Service virtualization studies the actual behaviors and replicates such interdependencies in the virtual equivalent, delivering accurate responses.

Ensure Test Stability

Incomplete or unstable services can lead to failures and delays in testing. A virtual equivalent is more stable, delivering reliable automation and peace of mind while testing.

Leverage Script-Free Tooling

Testers don’t need to write complicated scripts. Script-free and codeless tooling allow even novice testers to participate. In the occasional case where scripting is a must, Parasoft supports a variety of programming languages.

Accurately Replicate Real World Behavior

Parasoft’s service virtualization studies the application's actual calls to live services to accurately model requests and responses in the virtual version. A service definition can also be applied for better correlation.

Conduct Negative and Edge Case Testing Effectively

It’s difficult to make a dependent service intentionally behave in a bad way but these extremes need to be considered for accurate testing. Parasoft ensures that the virtual service meets a variety of testing conditions for more thorough testing.

Ways to Put Service Virtualization to Use

There are several areas that can leverage service virtualization to improve productivity.

Agile/Parallel Development

Modern software practices involve multiple operations teams working on pieces of the environment separately and then bringing them together through APIs to form the end product. When waiting for access to a piece of the application, DevOps teams can use service virtualization to simulate those missing pieces so they can continue their application development.

Performance Testing

Use service virtualization to make sure your application can handle the full capacity that is needed for high-demand response times, such as holiday sales. Often the cost of maintaining a live performance environment is close to equaling a company’s production environment. By using service virtualization, companies can simulate the dependencies of the APIs that they are testing and cut the cost of performance testing substantially.

Test Data Management

Companies have vast amounts of data that form a major part of their interactions with their customers, for example, a bank. This information may include PII (personally identifiable information) such as social security numbers. It is not appropriate to allow testers to have access to real production data sources for their purposes. Service virtualization gives testing teams the ability to generate data synthetically, for example, properly formatted facsimile social security numbers, which they can then use for testing functionalities.

Employee Training

Companies can use service virtualization to train employees in an application they will use on a day-to-day basis. This precludes trainees from having to train in the actual production version of the software, which may be tied to multiple complicated applications, and prevents them from modifying or deleting any sensitive data.

Partner Onboarding

Businesses often expose APIs to customers or business partners, including test environments to facilitate easy integration. Maintaining these test environments for partners has a cost, just like with any other environment. Service virtualization is an excellent technique for offering partners access to sandbox environments of your APIs at a lower cost.

Best Practices for Service Virtualization

Be conscious of the service virtualization required.

No need to create all or even a large part of the actual system behavior that you are virtualizing; you need only implement the essential transactions. And don’t attempt to emulate ad hoc requests. If you run across a bad test case from flawed input, you can generate a virtualized transaction that replicates it.

Recognize the test cases you are supporting.

Only include behaviors in your virtual service after you understand how the cases interact with them. Your test plan should delineate precisely what transactions to include in the virtualization. Allow the test plan to drive what transactions you will be virtualizing.

Test the right system.

Be sure you build test scenarios that provide validation of the system you're testing, not the service virtualization. Simulate an ideal replica of the dependent component. At the same time, the virtualization should be intelligent enough to let the client finalize a workflow. For example, when UI testing for a bank, the virtual service need only cover the correct depiction of a withdrawal or deposit; no need to verify account balance.

Each team should develop their own virtual services.

Every team has its individual requirements and when they create their own versions of virtual assets, no harm results if some redundancy occurs. Attempting to create service virtualizations that multiple teams must use only generates another limited service. Best practice is for the team that developed the real service to also create the virtual service because they have the local expertise.

Don’t use random responses.

Random responses won’t produce a duplicatable functional test. If you need to vary data you receive from a certain request, the best way is to create a non-changing response set for a group of comparable inputs. Instead, vary the traffic dissemination with random inputs.

Avoid data overloads.

Matching multiple transaction demands that have the exact same response means high maintenance. For example, match just the last digit of an account number. Mapping multiple unique account numbers to a single transaction addresses the problem of performance test database caching.

Be sure your application addresses failures.

Most test plans have fewer positive test coverage scenarios and more negative ones. This helps when developers spot exceptions. You can more easily recognize failure situations in a narrow test case rather than in system-wide situations.

Let the consumer build the virtual services.

Consumers understand the behaviors on which they rely. In a normal SOA (service-oriented architecture) environment, the service owner is unaware. Thus, a close relationship with the owner of the service is still essential because, as mentioned, local expertise can enable smarter, more scalable services.

Data Virtualization Example

Most businesses store data in many different locations, anywhere from hardware on their premises to the cloud. This information is adapted from multiple applications and file formats. Service virtualization allows any application to access relevant data regardless of format, source, or location.

Service virtualization in this case is a software layer between applications that accesses storage systems and the data in them. The layer interprets an app’s query or data request as required and provides results that cover multiple systems.

Note: Manufacturing test data can be difficult because of all the software components that rely on its validity. Once test data is consumed it cannot be reused again until the system state is reverted. With service virtualization, virtual test data can be “grown” based on a small sample and inferred constraints. This data can be reused and regenerated on demand.

Screen capture of Parasoft Virtualize in CTP

How to Get Started With Service Virtualization

Screen capture of Parasoft Service Virtualization Deployments and Events notifications.

To begin, it’s best to discuss with a Parasoft professional how to match your business’s needs with the service virtualization expertise Parasoft has to offer. After determining your needs, we assign a service virtualization team to address those needs. The team works with your company to develop an overall plan and best approach that includes test cases to obtain the data needed to solve problems before they happen, which is one of the main benefits of service virtualization.

Want to learn more? Read our helpful guide to find your team’s ideal service virtualization starting point and identify the best deployment model for your requirements. And check out our deployment options.

How Does Parasoft Help?

Make continuous testing easier and faster with service virtualization. Parasoft’s service virtualization platform empowers the developer or tester to weave automated testing early into software development while delivering virtual and stable services as and when needed.

Easily scale from a single user to a full DevOps deployment across teams. Reduce software development and testing overhead by building integrations earlier and stabilizing dependencies.

Avoid the overhead of testing with production environments. Simulate services that are otherwise inaccessible or unstable in Agile DevOps environments.

Frequently Asked Questions

Some organizations don’t, especially if they are not under heavy deadline pressures or if they already have access to comprehensive test environments. But large companies that have complex systems working interdependently can realize major benefits, such as:

  • Reducing operating expenses through cutting wait and configuration times and eliminating access fees.
  • Reducing capital expenses because companies use less hardware, fewer lab resources, and fewer licenses.
  • Reducing risk because development teams test earlier, faster, and more completely.
  • Increasing revenue by boosting innovation and quickening time to market.

Service virtualization goes beyond stubs and mocks by creating a more complete simulation of services and APIs. Stubs are only small system routines that don’t involve the entire program. Mocks mimic actual code but not the entire program. Service virtualization on the other hand provides the ability to test an application end-to-end. It also has the pluses of simulating real behavior, not using real data and large amounts of server space, and yet obtaining thorough information that helps avoid failures and bugs.

Service virtualization testing tools provide realistic simulated responses for all systems that have a normal or customized protocol involving communication and messaging. These include large ERPs like SAP, mainframes, databases, mobile networks, UIs, and third-party apps, to name a few.