You are on page 1of 16

Service Virtualization is used to simulate the interaction between two systems/services...

1 - when the underlying database is not available you would have your consuming service
pointed to the virtual service that is simulating the database. If the database becomes
available you can then point to the real system if you so desire.
2 - when you create a VS you need to understand that the data is not contained within the VS.
The data is a separate component that gets "loaded" at the time you bring up an instance of
the VS. You tell it the VS name (ServiceABC) and the data (SITRegression) you will be
using with the service. This allows you to have different sets of data for different types of
testing - say dev vs. function vs. performance... You just need to add the additional request /
response pairs to the appropriate data files. Since you are creating it from a WDSL you will
have limited amounts of data initially but adding data is very simple.
it will not virtulize db itself, it records only the traffic between client and server
transactions like request and respone and we can record only "SELECT QUERY"
transactions.

The basic concept is network behavior simulation. That is why the virtual models are
light weight and it is easy to build them compared to the traditional stubs. Only the
'behaviour', ,'traffic' gets simulated. It doesn't build the entire back end. The basic VM
can be edited, build-upon to make it more intelligent, respond to various other
requests etc...

getting zero transaction while using


vitualization using VSE recorder
What are you trying to virtualise, which transfer/data protocol, are you hitting correct
url, have you changed the configuration details of the application that you are
virtualizing?

i need to ask regarding Lisa . i am doing web service testing . i am validating some
field like Market value, percentage of any field. I created one filter from Lisa response
. Name as XYD and its value is 10.058. second filter, i created from Database and Its
name is DEF and its value is 10.057. I created these filter using XML xpath filer.
i validated them using assertion " Ensure properties are equal". when it complete the
ITR then it did not validate. Every time it failed my few account. I am not able to
perform my 100% validation.

Does we have any solution to ignore this small change in decimal value. i mean that
Any property in Lisa which helps us to overcome this scenario.
You can create Scripted Assertion. Write a code to Fetch out those values and
round them off to some decimal places, compare them and return true or false.
MQ service testing using CA LISA

You need to add the below jars to LISA lib folder. And you can get these from here
com.ibm.mq.commonservices.jar
com.ibm.mq.headers.jar
com.ibm.mq.jar
com.ibm.mq.jmqi.jar
com.ibm.mq.jms.Nojndi-2012.3.1.DnyMQ7-20120517.204657-1.jar
com.ibm.mq.pcf.jar
com.ibm.mqbind-5.304.jar
com.ibm.mqjms.jar
connector.jar
dhbcore.jar
Question
We have a requirement in my project to test secured services (using https
URLs).hence I would like to know is there any .jar files we need to install in ca
lisa7.1 to allow SSL connectivity. When I tried using using my default tool setup
secured(https) URL is not working fine.please help in my query.
Answer:

Check whether do you need to set proxy in LISA to hit the service? If so you there so there
are 2 options.
Option1: Create a companion "Configure LISA to Use a Web Proxy"
Option2: In your "local.properties" set the Web Proxy Details and enable it.
Note: If you go with Option1 it has to be created for each and every test where you have Test
Steps which requires web proxy.

In your local.properties file you need to update the values for section "HTTP
Proxy Server". Try after providing values for Webproxy host & port and restart
your Registry and Workstation.

Question:
I have virtualized a web service. Now, the live request for this service comes
from my middleware. I want to know the request that was sent from my
middleware to my VS. In the inspection view, under "HTTPS/Listen" step, I see
the property lisa.vse.http.current.transaction.body which should hold the actual
soap request sent. But it is not having the full request. The request is getting
truncated (half of the request and ends with _TRUNCATED_ )
Answer:

This is solved for me. I used a filter "Save Property Value to File" and saved the value
of "lisa.vse.http.current.transaction.body" in a file on the server. When i open this file,
my request message is not truncated. It's a complete message.
But my problem now is that I tried to do the same thing with VSE response. I tried to
save the value of "lisa.vse.response" property in a file but the content of that file is
showing something like "lisa.vse.TransientResponse@5734581" i.e. it's storing it as
an object representation instead of the actual xml message. What's the solution for
this?
What are you trying to do with these properties? This information should be
written to the vse_matches log. Also the reason why you get a Transient
Response is that you can have multiple responses, so you need to use a piece of
code to extract the body. However, the data is already in vse_matches and that
may be what you are looking for.

@Soumya - its to make LISA web console more efficient. Imagine you have a request that is
in mb's and you are invoking a VS multiple time (ex: PT), if we log entire requests on the
consoles then it would be an overkill. The best way (recommended) is to check out
vse_matches log.
If you are still interested to check out entire request on the console then please add an
environment variable LISA_MORE_VM_PROPS=-Dtestexec.lite.longMsgLen=65535 and
restart your LISA processes.

You can be using vse_matches.log or an other way round to get the request and
response content is using the Transaction Tracking mode, where the request received
and the response responded is recorded and can be viewed in the console.
If you are worried abt the performance of the Vservice, then use it only for
debugging... But the best practise is to investigate the vse_matches.log

@Soumya, how about enabling debugging?


Go to LISA_HOME and update your logging.properties (search
for log4j.logger.VSE ) file where
log4j.logger.VSE=INFO, VSEAPP
Also, I think with LISA 7.5.x you now get virtual service specific _matches.log. So if
your VS is named hello then the vse_matches log will be names VS_hello.log.
You can add the Scriptable Data Protocol to capture the VSE complete Request /
Response. I guess this will fetch the entire message without truncating.

Virtulaization for stateful transaction:

I need help here in knowing the procedure for recording the stateful/conversational txn and
the way we can maintain the context of the previous request.
The thing I am trying to achieve here is as follows

Two Request X and Y which will be sent to server one after another.

Capture an argument in X.

while handling Y rqst.


o Match an argument in Y against the argument in X.

Verify argument captured from X

If it "abc"

o VSE should handle this and respond back

else

act as a proxy server and routes the txn to server.

We are using Lisa7.0.3, we need to build a Virtual Service


for a RESTful webservice, the payload we have in the
request is JSON......Can we configure LISA7.0.3 virtual
services to return JSON response messages?

LISA 7.0.3 requires a Data Handler Protocol extension to convert JSON to XML for
use in the VSI. You can contact your CA SV sales team to get a hold of that
extension. However, it is recommended that you upgrade to LISA 7.1 or 7.5 in
which this extension has been productized as a Data Protocol.

JSON format is directly supported from version 7.1


Try creating service image from RR Pairs by selecting JSON Format in both request
and response side.
Question:
I have two question
1)In META, I have added the matchscript to return false, for incoming value not
equal to
source value but still i am getting the true response from META.
2)I have checked logs also in vse_matches.log file, there its not specifing match
script got executed or not.
How do i enable it to get logs?
Answer:

Perhaps you can explain what it is you are trying to accomplish. META transactions are
meant to be used to respond back when there is not a specific match. What would you like to
happen when there is no specific match found for a given signature? There might be a
different way to meet your requirements.
Why am I getting issue while starting Registry

There seems to be a comma in ur registry port. It shows 2,010. Actually it should be 2010.
In your local.properties, check if the following property is enabled and the port is correctly
mentioned or not without any comma in between:
#lisaAutoConnect=tcp://somehost:2010/Registry
Also, If you are connecting to your registry from ur workstation every time by giving the
URL (autoconnect checkbox disabled), then check the URL is correct or not (if there is any
comma in port number, remove that)
Please let me know if this resolves ur issue
Question:

Please read the entire thing carefully. Please refer attachment for high level flow.
I have a problem where my VS should pick a SWIFT format message from a Weblogic-JMS
queue called IN_QUEUE and respond back with a SWIFT format ACK message onto the
queue called OUT_QUEUE.

I have the RR pairs which i need to virtualize. I have to use the RR pair method to virtualize.
The problem is that the messaging channel is secure channel (t3s protocol). My weblogic
admin has provided me the .pem cert file which I have imported into a keystore/trust-store
file on my LISA Workstation machine using the java keytool utility, and made necessary
settings in required props/files under Lisa_Home directory and am able to publish a sample
message on IN_QUEUE successfully.
But how do I create a secure VS which'll subscribe on this IN_QUEUE and pick messages on
it?
I have done the following and it's not working:
I created the VS with RR pair method, by choosing SWIFT as data protocol (I have imported
the required jar) and choosing the "Standard JMS" as transport protocol (I don't see
Weblogic-JMS protocol. Is there one?). But i couldn't see any security related settings while
creating VS with this method. Once the VS was ready I deployed it on server and I again
imported the .pem cert file into a keystore/truststore file on my server, and i made necessary
props settings in various files under LISA_HOME directory.
Now when I go to Server Console and start the VS, it starts polling to the IN_QUEUE and
fails after four attempts (maybe retry is set to 4). The VS is "Ended" automatically after that.
It fails with the following exception:
==================================================================
==========
| Exception Executing Messaging/ESB Step: javax.naming.CommunicationException [Root
exception is java.net.ConnectException: t3s://SERVER:PORT: Destination unreachable;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target; No available router to destination]
==================================================================
==========
| Step:
listen
---------------------------------------------------------------------------| Trapped Exception: null
| Trapped Message: javax.naming.CommunicationException [Root exception is
java.net.ConnectException: t3s://SERVER:PORT: Destination unreachable; nested exception
is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target; No available router to destination]
---------------------------------------------------------------------------STACK TRACE
javax.naming.CommunicationException [Root exception is java.net.ConnectException:
t3s://SERVER:PORT: Destination unreachable; nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target; No available router to destination]

at
weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
Please help my VS communicate securely with the JMS server :-)

Question:

I have a use case where the application A sends out a MQ message request to application B.
Application B is then expected to send multiple response back. Both the request and
responses would have a common id (ReqId).
I tried creating the service using request/response pairs and by using the option in LISA
called "Correlation" where we can choose any of the below values:
1. Sequential, 2. Correlation, 3. Message ID to Correlation ID, 4. Message ID
I have tried using both "Correlation" and "Message ID". It created a service image with a
single request and multiple responses in it. But when I played back, LISA has consumed the
message from the request queue and sent only the first response back to the response queue as
against to sending all the responses back.
Please let me know if there is any other setting that needs to be set for making this work.
Note:
This is "IBM MQ series" and "Native Client" client mode
Asynchronous MQ with Multiple Responses
Question:
I have a request/response xml pair and in the response I am expecting an
attachment when I implement this approach. I am able to virtualize Req/Res and
when hit in SOAP UI, I am getting the response but without attachments. Would
someone please help me how to virtualize an attachment in the response via
Req/Res xml pair approach?

o use rr-apirs (req and rsp pairs), you need to name your files like this:
AnyRequestName[NUM]-req.txt or AnyRequestName[NUM]-req.xml
AnyResponsetName[NUM]-rsp.txt or AnyResponseName[NUM]-rsp.xml
the key is to have -req and -rsp at the end of the file name and both of this filenames should
match exactly, so if I have request and response files I'll name them as sample1-req.txt and
sample1-rsp.txt

Now, let us try to understand how LISA can help you solve your current challenge, Do you
have access to the XSD/schema files for your target service? You could easily use Eclipse
IDE for ex: and create sample XML's based on your req and rsp schemas, name them as I
have mentioned above and pass it on to LISA.
I also have another question in which I have to parameterize values in the VSE
image response itself.Can this be done or does it require the data to be hard
coded in all the instances which will not be a viable solution.I know this can be
done in a normal web service testing scenario but will this work in the VSE or do I
have to write an extension for this.

I am now in the process of creating a Virtual Services to eliminate third party


dependancy. The challenge is we only have a request and response pattern and
we do not have a WSDL file. Using iTKO LISA I tried to create a VSE using the
request/response pair but it is not recognizing the Request/Response XML.As
mentioned in the documentation I have the SOAP headers also included.What is
the problem here?

One of the main benefits of having virtual services is to bring down the cost of making
constrained systems available 24/7 and on demand. I personally believe that
Quality == Benefits/Price
SV not only eliminates the uncertainties surrounding the availability of constrained systems
but it also saves time and resources a.k.a h/w and people hours spent on designing, setting
and maintaining such systems. Business is driven by time, cost and quality. SV saves you
time and time is money so it reduces cost. So if you have to measure Quality, you have to
measure it relative to the time and cost saved by implementing SV and the many benefits it
brings on the table.
The key factors that you need to use to create the estimation model would include:

Is the framework able to automatically create the virtual service?

What interface and protocol being used (ie MQ and HTTP/S vs IMS)?

Complexity of the service being virtualized (simple/moderate/complex)

Data capture methodology (listen and record, manually entered, etc)

Conditioning of input/output pairs (how much modification, if any, is needed)

Does the service need to support non-functional testing (performance and resiliency
test scenarios)

The products that are available today offer different methods to capture the
information thus having a standard Estimation Technique would be specific to
the vendor solution. For example - there are solutions that will build the Virtual
Service automatically for a vast array of protocols while others require extensive
human interaction to create a service.
Another important aspect is the use case itself. For example, Virtualization for
regression testing is a very different LOE from Virtualization for parallel
development or plus-one scenarios. Similarly, Virtualization for performance
testing will be different effort from Virtualization for integration testing. You must
keep the business driver in mind when scoping and sizing any type of effort
estimation.
Recently I have come across a issue that virtual services which are created in DIT
env , are not working in SIT or Performance Testing env. But after analysis I came
to know that, this was because of environmental configurations are different
from environment to environment like MQ specifications, JNDI etc.,.. So is there
any best practice so that when I create a virtual service I can make these
services will work in any environment with little config changes, (mq, JNDI)
rather than re-creating the virtual services from the beginning .
Running VS in Production and Handling Sensitive Data

Several issues routinely come up in discussions about Service Virtualization. The first
concerns whether you can run a virtual service in production. You can create an accurate
representation of a production environment, but you wouldnt run a virtual service in
production because it doesnt do the real work. For example, you can simulate a virtual
service that does a credit check for dev and test, but in production, you would want to do the
actual credit check.
The other issue that comes up on a regular basis is the handling of sensitive data. Virtual
environments encapsulate all test data and have the ability to desensitize or obfuscate that
data based on predefined patterns, keeping the data integrity intact. Once a behavior is
captured inside a virtual service, there is no sensitive data left. Static desensitization design
patterns also provide another level of sophistication when it comes to securing sensitive data.
Answer:
Service Virtualization in Production has a lot of merit and actually is used in
enterprises TODAY. It all depends on the type of data. For example, Oracle
Coherence provides object level caching at the middleware layer and caches
information like product catalog, etc. If the actual service providing latest product
catalog is down, the front-end shopping cart still works, because Coherence is
able to provide the "cached" object response. "Caching" is one of the techniques
used Service Virtualization too!

Question:

I have a specific problem on MQ Virtualization. I have one request queue named Q.REQ and
two response queues Q.RES1 and Q.RES2. Please refer the attachment for
diagram.problem.JPG
Now, when my middleware puts an xml message into the Q.REQ, it'll be picked by the
downstream app and it replies on two different queues with two different xml response
messages.
My scope of testing is the middleware. But for this, my downstream is not yet available. My
requirement is that I have to virtualize the behavior of my downstream app.
How can this be done?
My Solution: solution.JPG
I created two different recordings (req-res pairs method)and ended up with two vsm/vsi
sets.In both the recordings, the request message will be same but the response message will
be different.
The first VSM picks the message from Q.REQ and puts it onto Q.RES1. I have also created a
temp queue Q.TMP and edited the VSM so that it puts the xml request message from
middleware onto Q.TMP.
The second VSM will be listening on Q.TMP. When it sees a msg on Q.TMP, it responds on
Q.RES2.
This solution is working fine for me. I just wanted to know if there is a better way to do it. I
mean can it be done using only in one recording? instead of using two?
Answer:

Two options here:


1. In MQ recording, you can listen on two Qs as response Q. So this you can create one VS
for your scenario.
2. you can customize the VSM which you recorded to send another RSP back.

Option 1: I tried this option where we configure two response destinations in the recording
wizard. But I guess this sends the same recorded response to two different response queues.
But my problem is that I have "two distinct responses" to be sent to "two distinct queues". I
was not sure how to do this.
Option 2: I recorded with one request-response pair (I guess we can't record with one
request xml and two response xml in same folder, since response1 and response2 will have

different names). I opened the VSM. I opened the publish step. I see the following in queuename under Publisher Info section:
{{lisa.vse.mq.publisher.destination.respond}}
Now, if I have to respond to some other queue, then I have to change the value of this
property. How can I do that?
In the 1st option, I believe that LISA should record two distinct responses with listening two
Qs otherwise it doesn't make sense to listen two Qs for one response in one transaction. I
have not tried this before but it should work as expected.
LISA doc also mentioned this. "On this (recording destination setting) tab, we set the
response and response proxy queues. You may remember that in case of messaging, more
than one response is possible for a given request. Use the Add icon to register a set of
response and response proxy queues. Before registering the response queue that you want to
use for unknown requests, select the Use for Unknown Responses check box."
In the 2nd option, I mean that you can either "insert a MQ test step to send your own rsp
message back to another rsp Q" or "insert a script step to control how you want to play with
everything in vse, vse.request, properties, your response etc".
My VSE is getting automatically down. I see the following error on my LISA Server
Console:
The VSE VSE@Default is no longer running.
(PFA the error screenshot VSE_Error.JPG)
Question:
I have one requirement to extract value of some input request field and replace
that with Replacement URI value in my .VSM in Live Invocation step.
Example request:
-------------------------<soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/ ">
<soap:Header>
<ns2:requestHeader xmlns:ns2=" http://xyz.abc.com ">
<serviceOption>
<key>ENDPOINT_URL</key>
<value>/WebService/services/UserDetail</value>
</serviceOption>
</ns2:requestHeader>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelope>
I want to set the value of <value>/WebService/services/UserDetail</value> in
replacement URI by using this syntax:

{{=request_Envelope_Header_requestHeader_serviceOption_value_text_;}} or
{{=request_soap:Envelope_soap:Header_ns2:requestHeader_serviceOption_valu
e_text_;}}
and both the syntax were not working.
Any help on how to fetch the value of inco
Yes, if its a restful service then you create a VS without using any
DataProtocolHandler and just use http as transport. LISA will take care of rest of
the things. If your call is POST or PUT and the request side payload is JSON or
XML then you need to use OOTB JSON DPH available in latest LISA release. ming
request tag will be highly appreciable.

I was able to create a virtual service through wsdl.


Navigation to those who need the answer : - Create a new project -> create new VS image ->
from WSDL -> give the Image name and the Model name -> give the wsdl for which the VS
needs to be created -> Deploy the vsm model to VSE (Check the console whether the VSE is
running).
************************************************************
Burt,
One more question in the service model i do see the connection from the Virtual service
router is incomplete (has the message "alternate connect from virtual service router to null").
Is that an error or is it good to go?
I have come across a situation where data relationship need to be maintained between to
different stateless virtual service and I am wondering what will be the best way to design the
virtual service using LISA.
Well there are two methods within a service, Update & retrieve. Client application will call
update method to perform update to data, retrieve to pull the data back.
eg: Using update method the Email ID would be updated for a user , now every retrieve call
for the user need be returned with the updated email ID for the user.
The challenge in front of me is that the stateless virtual service which I create need to respond
back to the calling client with latest updated data. All suggestions and ideas are welcomed.
Answer:

There is concept called sharedModelMap, which is a VSE level variable to keep


changes tracked between models. Please refer to this documentation in the LISA
support website
https://support.itko.com/confluence/display/technotes/Sharing+Data+...
I am also pasting information incase if you don't have access

Sharing Data between Virtual Service Models


Skip to end of metadata

Added by Cameron Bromley, last edited by Anne Rhoades on Apr


19, 2012 (view change)

Go to start of metadata

Sometimes you need to share data across virtual services.


Example 1

A classic example is that service A needs to create a new user account ID and service
B needs to know what that account ID is in order to respond to, say, a credit check
where the request contains the user name but not the ID.
One VSM can do something like this:
{{==com.itko.lisa.vse.SharedModelMap.put("accountNameToId", userName,
ACCOUNT_ID);}}

and the other VSM can retrieve it as follows:


{{==com.itko.lisa.vse.SharedModelMap.get("accountNameToId", userName);}}

The first parameter to get/put is the optional namespace. It is optional but


recommended so that there are no clashes of key names.
Example 2

Perhaps another example might help.


Model A might update an account balance like this:
{{=com.itko.lisa.vse.SharedModelMap.put("AccountBalance", accountId,
125);}}

and then Model B might retrieve it like this:


{{=com.itko.vse.SharedModelMap.get("AccountBalance", accountId);}}

The above implies you are directly editing a response meta transaction but you can
also use the JavaScript step to directly access the SharedModelMaps and the testExec
("state").
If you want to remove an entry, call SharedModelMap.remove(namespace, key).
Each unique namespace is backed by a map that is restricted to a default capacity of
256 key/value pairs. Map entries are recycled in a LRU fashion.
If you need more capacity you can call :
SharedModelMap.setCapacity(namespace, newCapacity)

SharedModelMap is thread-safe - two VSMs can access and update it at the same time
(internally, access to each namespace map is synchronized on the map itself).
The maps are not persisted across VirtualEnvironmentService restarts.
Of course you can use a JDBC step to get/set data from a permanent store, or write
your own class that does something similar to SharedModelMap but permanently
stores the data in a database or a memcached instance.
The first thing to keep in mind is that every LISA step is available for
consumption within a virtual service model. So, to start with you should get
access to an external database that you can do whatever you want with. In the
database, make a simple table with all of the values you need in your virtual
service(s). Then, within your model you use javascript to build sql queries based
on input into the model, such as an account ID, or customer Id. Usually and
UPDATE operation comes with all the information to update a table so your query
would be something like an Update/Insert statement to the database table you
created. The RETRIEVE operation would simply build a retrieve query based on
input from the service call and then parsing the values from the database query
and using them in your XML response.

To sum it up:
1. Create simple database table with columns representing values you would parse for your
virtual service
2. A database call in your model that does an update or insert based on a SQL created using
javascript and using values sent into the virtual service model using the UPDATE operation.
3. A database call in your model that builds a search query based upon values sent to the
model from the RETRIEVE operation.
Once you create a model like this there are two things to keep in mind.
1. Your model will act like a live service including 'creating/editing' real data in your data
table when people do an add. Make sure people don't go crazy by adding 100,000 of rows of
new data to your table. This will cause things to slow down unless you add indexing. At that
point you are getting complex enough to just use the real service.
2. You have added a possible external constraint to your model should there be issue with the
external database you are calling.
I know its complex. It represents one of the most complex virtual service models I have ever
created, but.....it works like a champ!!

Actually it is a map in Java, LISA stores the valus during run time and gets back. Since this

map is at VSE level rather than VSM level. All you need to use is below two commands to
put and get.
If get is failing, you might either have different VSE's like one local and one remote or some
other error not related to map. Also the name of the map should be same. this should be used
as a property inside VSI, you can also use javascript step to put and get, just make sure it is
not throwing error
{{=com.itko.lisa.vse.SharedModelMap.put("AccountBalance", accountId,
125);}}

{{=com.itko.vse.SharedModelMap.get("AccountBalance", accountId);}}

Question:
I'm virtualising a web service. I have one transaction which will have multiple
responses based on one value in the input. How do i select one among the
multiple responses using the match script?

Answer:
In the match script set a property and add a post-assertion of the script step to
check the property value to direct the transaction follow to a different selection
follow.

Answer:

keep it simple, the best way to handle this situation is:


add different exact match pairs for a given signature and have a response selected based on
incoming request field i.e. the one that keeps changing.
Just set the value as true / false and you will be able to set in match script
if you return true - means that i the response selected, if you return false - the response
will not be selected

How to create virtual services or images using WSDL in LISA 5.0.26.

Answer:

think the easy way to do this is


In your VSM, you can insert a step before incoming request to be matched with a VSI. The
step you can do a property replacement. or use script to do that.

You might also like