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.
Community comments
each has there place
by Peter Taylor /
Re: each has there place
by Jonathan Allen /
mocktail - Open source service-virtualization solution
by ShriKant Vashishtha /
Re: mocktail - Open source service-virtualization solution
by Jonathan Allen /
There is many more tools
by Wojciech Bulaty /
Virtualization using CA-Lisa
by Jino Matthew /
many such tools - including Wilma
by Tamas Kohegyi /
Great read thanks.
by Julia Frohwein /
open source and free to use tools comaprison
by Wojciech Bulaty /
each has there place
by Peter Taylor /
Your message is awaiting moderation. Thank you for participating in the discussion.
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 /
Your message is awaiting moderation. Thank you for participating in the discussion.
If you would be interested in writing a short article about Rational Integration Tester please contact me at jonathan@infoq.com. I'm sure many of our readers would find that product to be useful.
mocktail - Open source service-virtualization solution
by ShriKant Vashishtha /
Your message is awaiting moderation. Thank you for participating in the discussion.
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.
mocktail.svashishtha.com/
github.com/vashishthask/mocktail/
Re: mocktail - Open source service-virtualization solution
by Jonathan Allen /
Your message is awaiting moderation. Thank you for participating in the discussion.
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.
www.infoq.com/about
There is many more tools
by Wojciech Bulaty /
Your message is awaiting moderation. Thank you for participating in the discussion.
en.wikipedia.org/wiki/Service_virtualization#To...
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 /
Your message is awaiting moderation. Thank you for participating in the discussion.
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
www.qatrainingworld.com/product/itkoca-lisa-virtualize-online-training/
and see what they have to offer .
You can also register here for a free demo class
www.qatrainingworld.com/register/
many such tools - including Wilma
by Tamas Kohegyi /
Your message is awaiting moderation. Thank you for participating in the discussion.
There are tools: en.wikipedia.org/wiki/Service_virtualization</ä>
And there are tools those can combine both routes (mock entire service AND act as proxy and record traffic), like the open sourced Wilma (epam.github.io/Wilma/).
Great read thanks.
by Julia Frohwein /
Your message is awaiting moderation. Thank you for participating in the discussion.
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: goo.gl/v58hed.
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: goo.gl/y9az8a.
Hope this is helpful.
open source and free to use tools comaprison
by Wojciech Bulaty /
Your message is awaiting moderation. Thank you for participating in the discussion.
Have a look at this comparison of several open source and free to use next generation service virtualization tools: trafficparrot.com/Service_virtualization_and_st...
It compares tools like Wiremock, Hoverfly, Mountebank, Traffic Parrot and Charles Proxy.