Thursday, November 10, 2011

Understanding Snapshot Attribute in LoadRunner

A snapshot is a graphical representation of the current step and it is an Attribute to functions like Web_URL, web_custom_request etc in LoadRunner

A Sample request is shown below

web_custom_request("Sample_Request",
"URL=http://… /Service",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Mode=HTML",
"Snapshot=t1.inf", //Snapshot attribute is commented
"EncType=text/xml; charset=utf-8",
"Body="
LAST);

When working in Tree view, VuGen displays the snapshot of the selected step in the right pane (as Shown Below). The snapshot shows the client window after the step was executed.(Refer Snapshot)

LoadRunner Snapshot

VuGen captures a base snapshot during recording and another one during replay. You compare the Record and Replay snapshots to determine the dynamic values that need to be correlated in order to run the script.

If Snapshot Attribute is not placed in the request, then Image file will not be generated during the replay(Refer Snapshot).

web_custom_request("Sample_Request",
"URL=http://… /Service",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Mode=HTML",
"EncType=text/xml; charset=utf-8",
"Body="
LAST);

LoadRunner Snapshot

Tutorial on Rational Performance Tester

A Very good tutorial on Rational Performance tester (RPT). This tutorial includes

  • Rational Performance Tester: Architecture
  • Rational Performance Tester: Features
  • RPT and the Performance Testing Framework (PTF)
  • Rational Performance Tester: Test Development
  • Rational Performance Tester: Workload Design
  • Rational Performance Tester: Reports
    and more

http://docs.google.com/present/edit?id=0ATOftuUbGkRvZGR3bTkyZGRfNTRncTU2ZGdkYg&hl=en

Little's Law

In continuation with my earlier post “Decoding concepts of Performance Engineering” I will try to derive Little's law in this post for better understanding

Consider a steady state system which has only one user and sends the requests at consistant intervals and response time of the requests were observed to be 1 sec.

No of Customers in the System = 1
Response Time = 1 sec (Service Demand)
So Maximum Throughput = (1/Service Demand) = 1 Request/Sec (Based on Utilization Law)

It implies average number of customers required being in the system to achieve 1 request/ sec with an average response time is 1 sec is 1 user

Similarly assume if the response time of the system is 0.1 Sec

Response time = 0.1
Max Throughput = 1/Service Demand = 10 requests/Sec

So One single user can simulate max of 10 requests/sec with a average response time of 0.1 sec

Little's Law






Average Number of Customers = Response time * Throughput

Little’s Law states that average number of customers in a system is equal to product of throughput and response time.

Decoding concepts of Performance Engineering

In most of the situations we have a tendency of using the formula’s without understanding the concepts behind it, because of which we may not be able to apply the laws correctly where it is required.

The following example will help in understanding the some of the performance rules

A system was subjected to 10 requests in a span of 2 min and got the responses for all requests during this period and Utilization of the system during the time frame was observed to be at 50%.


Request Arrival rate for that system is  10/2=5 requests/Min
Throughput = 10/2 = 5 Responses/Min


in the above example, system utilized 50% of its resources for serving 5 requests. For Each request, it consumed 50%/5 of system resources. This value is called service demand of that resource


From the above example the formula for service demand can be derived as below
Service Demand  =Utilization/Throughput.
similarly Utilization = Throughput * Service Demand - This is also called utilization Law


The utilization of a resource is equal to the product of the throughput of that resource and the average service demand at that resource.

Extracting LoadRunner Error messages based on Scripts

Sample C# code to fetch the LoadRunner Error messages based on Scripts using MS Access mdb file

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;


namespace LR_transaction
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
        private void button1_Click(object sender, EventArgs e)
        {
      
            //Create the database connection 
  
            OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\abc.mdb");

            //create the command object and store the sql query 

            OleDbCommand aCommand = new OleDbCommand("select [ErrorMessage].[Error Message] from ErrorMessage where [ErrorMessage].[Error Id] in(select [Error_Meter].[Error Id] from Error_Meter where [Error_Meter].[Script Id] in (select [Script].[Script ID] from Script))", aConnection);          
            try
            {
                aConnection.Open();

                //create the datareader object to connect to table 
                OleDbDataReader aReader = aCommand.ExecuteReader();
                Console.WriteLine("This is the returned data from the table");

                //Iterate throuth the database 
                while (aReader.Read())
                {
                       MessageBox.Show(aReader.GetString(0));
                               
                }
              
                //close the reader 
                aReader.Close();
    
                //close the connection Its important. 
                aConnection.Close();
                Console.Read();

            }

            //Some usual exception handling
            catch (OleDbException ex)
            {
                Console.WriteLine("Error: {0}", ex.Errors[0].Message);
            }
        }


     }
}

Integrating Sitescope Monitor with Controller


To integrate a SiteScope server that needs authentication, modify the modify the LR installation folder\dat\monitors\xmlmonitorshared.ini file as follows:

1. Locate the [SiteScope] section in the file.

2. Append &account=administrator, or if you want to log in using other user (e.g., XXX), append &account=XXX, to the MetricListURL.

Note:
The user XXX must have the right permissions in SiteScope and may be different from the user name. The SiteScope server should be accessed as


3. Add "QueryLoginInfo=1" at the end of the section.

With this, you should be able to see a login window when adding measurements.

Monday, November 7, 2011

Simulating SOAP messages via JMS in LoadRunner using Web Services Protocol

Web services facilitate application to application communication for building integrated systems of web application components and HTTP is the most standard transport protocol used for the communication but it will be difficult to send messages from one subsystem to many using HTTP. Sending SOAP messages via JMS is a viable and a simple option for such requirements.


JMS is a J2EE standard for sending messages, either text or Java objects, between Java clients.


There are two scenarios for communication:


Point-to-Point. JMS implements point-to-point messaging by defining a message queue as the target for a message. Multiple senders send messages to a message queue, and the receiver gets the message from the queue.


Publish-Subscribe. Each message is sent from one publisher to many subscribers through a designated topic. The subscribers only receive messages sent after they have subscribed.


LoadRunner supports both the communication but I will focus sending SOAP over JMS point-to-point communication using LoadRunner in this post.


Vugen supports point to point by allowing you to send and receive JMS messages to and from a queue.


Please follow the steps to simulate JMS traffic to TIBCO in LoadRunner


       1.    Install JDK and set the class path accordingly

       2.    Download TIBCOjms.jar file from the application support team and set the class path of the jar in VUGEN- Runtime settings – Classpath

       3.    Request your application team to provide the following details and update in  Runtime settings

a.    JNDI Initial Context Factory - com.tibco.tibjms.naming.TibjmsInitialContextFactory (For Tibco)

b.    JNDI Provider URL

c.     JNDI Context Factory

d.    Credentials(userid/Password)


       4.    Create a Sample script to verify the connection


Action{

char text[100];

strcpy(text,"Sample Message to be Send to TIBCO");

lr_output_message("%s text is ", text);

//sending message

jms_send_message_queue("Sending message",text, "QueueName");

return 0;

}

JMS Runtime Settings for Point-to-Point
JMS Runtime Settings