Service Virtualization as an Alternative to Mocking

| by Jonathan Allen Follow 612 Followers on Apr 22, 2013. Estimated reading time: 1 minute |

Mocking via dependency injection is often a messy endeavor. For even the simplest of applications it often involves creating new interfaces, taking on a dependency on an IoC Container, and in general adds a lot of unnecessary complexity. And after all that, you still have to write the mocks themselves, many of which aren’t useful for anything besides simplistic unit tests.

Products such as CA Lisa Service Virtualization offer an alternative approach. Rather than mocking individual classes, these testing tools allow you to mock entire services at the network level. From the application’s perspective it is talking to a real service backend, even though in reality that backend may not even exist yet.

There are two common ways of setting up a virtualized service. The first is to start with the contract (e.g. a WSDL or other protocol-specific descriptor) and create pre-determined responses. This can be done manually using normal Java or .NET code, or you can use a commercial product. An advantage of this method is that the team writing the component doesn’t have to wait for the real version of the service to be completed. The downside is that the real version needs to actually match the fake one, which becomes a questionable proposition as timelines become longer.

The other route is to use traffic recordings. A tool sits between the component under test and its down-stream dependencies. This tool basically acts as a proxy, gathering information about how the components interact. Later those recordings can be used to simulate the conversation between the component and the servers it depends on.

Both routes are viable for most communication protocols. With the right plugins and filters, the test tool should be able to understand message queues, REST, SOAP, raw TCP, or any other means of exchange.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

each has there place by Peter Taylor

I think mocking makes sense at a unit test level. Good IOC containers have a great deal of value and rarely do harm. Loosely coupled code is the key to success. When you are ready to think about integration testing then service virtualization makes sense.

IBM also have a commercial offering in this space called Rational Integration Tester.
Peter Taylor
An IBM employee not speaking on behave of IBM

Re: each has there place by Jonathan Allen

If you would be interested in writing a short article about Rational Integration Tester please contact me at I'm sure many of our readers would find that product to be useful.

mocktail - Open source service-virtualization solution by ShriKant Vashishtha

We have been working in this space for quite a while to create an open-source solution for Java platform. The solution not only virtualises the web-services response the way Lisa does but at also potentially generic solution for any external interface. You can virtualise the database also which is handy when you want to record a test case with production scenario and prod-db may not be available.

Currently it's in beta but will be available soon.

Re: mocktail - Open source service-virtualization solution by Jonathan Allen

Send a note to Charles Humble, our lead editor for Java news, once it's ready. I'm sure he would be interested in it.

There is many more tools by Wojciech Bulaty

Other popular tools for testers/QAs: SoapUI (HTTP), Ready! API (HTTP), Parasoft Virtualize (HTTP/TCP/MQ/...).
Popular tools for developers: WireMock (HTTP), betamax (HTTP), mountebank (HTTP/TCP), VCR (HTTP).

Virtualization using CA-Lisa by Jino Matthew

I have been using CA-Lisa in our company , and have to say its by far the industry leader in virtualization . Easy to use and very robust tool , supporting all protocols in the industry .

If you are looking to get trained in LISA do visit

and see what they have to offer .

You can also register here for a free demo class

many such tools - including Wilma by Tamas Kohegyi

There are tools:</ä>

And there are tools those can combine both routes (mock entire service AND act as proxy and record traffic), like the open sourced Wilma (

Great read thanks. by Julia Frohwein

You might find it helpful to look at real user reviews of all the top Service Virtualization tools on IT Central Station. You mentioned in your article CA Service Virtualization which is currently rated #1 on our site:

This QA Manager looked at a few different options before making his decision: "We considered HP SV, IBM GreenHat, Parasoft, and others. The benefits with CA SV are cost savings on hardware and earlier defect identification". To see the rest of his review click here:

Hope this is helpful.

open source and free to use tools comaprison by Wojciech Bulaty

Have a look at this comparison of several open source and free to use next generation service virtualization tools:

It compares tools like Wiremock, Hoverfly, Mountebank, Traffic Parrot and Charles Proxy.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

9 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you