Archive

Archive for February, 2009

Running LoadRunner scenarios from QualityCenter automatically

February 25th, 2009

There is a very nice tool provided by HP Support that allows running few LoadRunner scenarios from QualityCenter using command line. You can use it to run load tests in regression every night for example.

Officially HP doesn’t support this small tool and they say it’s free and open source. There are two versions available. One for QC 9.0 and another for QC 8.2 SP1. If you want to find it on HP support page, just search for document ID KM191021.

cpt38343a – this is my local mirror for QC 9.0 version

LoadRunner ,

WSDL from source code

February 25th, 2009

One (if not the biggest) anti pattern for me is when developer generates WSDL file from source code. Have you ever tried to create HTML page in MS Word? If so, then you know that 90% of the code is crappy. WSDL is a service description. How you want to understand or test it if the code looks like a mess?

Another thing – service description depends on your business. Do you really want to leave it for automated tools? Do they know your business area better?

So, next time when someone gives you WSDL generated from source code, you don’t even have to look at it to reject it.

General ,

IBM WebSphere MQ testing using LoadRunner

February 23rd, 2009

My first script for WebSphere MQ testing was written in Java as Java Vuser script. It was pretty simple since I was using just MQ JMS API.  There is lots of examples howto connect to WebSphere in Java. Here is one http://hursleyonwmq.wordpress.com/2007/05/29/simplest-sample-applications-using-websphere-mq-jms/.

But howto test WebSphere MQ if you don’t have Java license in you LoadRunner?

There is a way to do that. LoadRunner API contains several JMS functions:

jms_receive_message_queue()
jms_send_message_queue()
jms_send_receive_message_queue()
jms_set_general_property()
jms_set_message_property()

First of all you need to have “Web Services” license to use them.

Here is what you need to do:

  • Get details of your environment like: MQ server IP, port (probably 1414), Queue Manager name, Queue name and channel name.
    Install IBM WebSphere MQ Client on machine where you have LoadRunner Controller (or LoadRunner Generator if you are using remote one). MQ Windows Client for WebSphere 6.0 can be downloaded here.
  • Setup details of our WebSphere MQ server on the client. We will use JNDI to store connection details (host, port, etc…)
  • Edit file C:\Program Files\IBM\WebSphere MQ\Java\bin\JMSAdmin.config and set

INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/C:/JNDI

  • Create new .scp file and put there your MQ server details. Here an example

DELETE QCF(QueueConnectionFactory)
DEFINE QCF(QueueConnectionFactory) QMGR(QUEUE_MANAGER) tran(client) chan(SYSTEM.ADMIN.SVRCONN) host(192.168.12.13) port(1414)
DISPLAY QCF(QueueConnectionFactory)
DEFINE Q(MY_QUEUE) QUEUE(MY_QUEUE) QMGR(QUEUE_MANAGER)
DISPLAY Q(MY_QUEUE)
end

  • Last step for MQ Client is to generate .bindings file (placed automatically in C:/JNDI) with JMSAdmin tool from C:\Program Files\IBM\WebSphere MQ\Java\bin directory. Assuming that your .scp file is named My_qm.scp, use this command:

JMSAdmin < My_qm.scp

Now in LoadRunner:

  • Create new Web Services script
  • Open Run-Time settings (F4) and go to JMS/Advanced
  • Change JNDI initial context factory to “com.sun.jndi.fscontext.RefFSContextFactory”
  • Change JNDI provider URL to “file:/C:/JNDI”
  • Change JMS connection factory to “QueueConnectionFactory” and click OK

Use this sample code to send and receive a message from IBM WebSphere MQ:

//setting JMS message property JmsMessageID
jms_set_message_property("JMSMessageID","JMSMessageID", "12345");

//sending message
jms_send_message_queue("Sending message","My cool message", "MY_QUEUE");

//receiving message
jms_receive_message_queue("Receiving message", "MY_QUEUE");

//displaying message
lr_message(lr_eval_string("{JMS_message}"));

Received message is saved in “JMS_message” parameter automatically by LoadRunner.

Done. Smart and simple :)

LoadRunner , , ,

Cleaning browser cache

February 16th, 2009

Hello

As you know, browser can store some downloaded HTML/JPG/etc file from remote server on local hard drive so you can access it faster next time. This is called “cache”.

There is an option in LoadRunner VuGen to simulate browser cache behavior with your web performance testing. But how to use it and when? Here are my suggestions.

Don’t clean the cache
Your application is rather something internal used by (mostly) the same people in one company – In that case I suggest not to clean the cache because this will reflect users behavior in your tests. If you ask why? then ask yourself how often you clean your browser cache. Once a week? Once a month? Every login/logout? Are you getting the idea?

With such settings, your transaction performance graph would look like this:

without_cache_cleaning1

After first iteration with cache enabled, transaction performance is much smaller. It’s because user gets most of the files from the cache.

Clean the cache:
Your application is accessible from the Internet, and your customers are basically everyones on the net – in that case I suggest to clean the cache because its more probable to have new person without cached content already.

This is example performance graph after tests with cleaning browser cache.

with_cache_cleaning1

In each iteration, user has empty cache at the beginning so he need to get all the files from remote server.

Conclusion:

Only by cleaning/not cleaning the cache your transaction performance can vary significantly!!!

LoadRunner , , , ,