Friday 21 June 2013

Load Runner Tips and Tricks

1. Consult your developer if you need help to identify the protocol used by the application.

2. Some other applications, such as antivirus, VPN’s, firewall, and so on may interfere with the recorder. In case of problems, always look to see what is installed on the machine and try to disable software that looks like it is interfering with socket level data.

3. Delete (or comment out) all the “web_add_cookie” statements in the script. Some applications use explicit cookies to keep track of users. Therefore cookies statements have to be commented out otherwise old cookies are sent to the server again and it will not work.

4. Delete all the web_url (…..) statements in start of the script, which are downloading the windows updates or something like that.

5. If you are using the Multiple Protocol recorder, you can use this option of Tools →“Regenerate Vuser” to regenerate the script, if the earlier modified script is not working fine.

6. Sometimes, you will encounter cases where the Web recorder (Single and Multi) records some initial login steps but nothing else after that, even though it is still using the HTTP protocol. This can happen if the application is dependent on the cache in some way. By default, LoadRunner recording will disable the cache.

To set LoadRunner not to interfere with the cache setting, change the following in registry:
a. Go to Start → Run, and enter regedit to open the registry editor.

b. Navigate to HKEY_CURRENT_USER\Software\Mercury Interactive\ LoadRunner\ Protocols\ HTTP\Analyzer

c. Set AddNoCacheHeaderToHtml=0.

7. The following are limitations of the Single Protocol Web recorder. If any of the following is causing a problem, you are recommended to switch to use the Multiple Protocol web recorder to record.

Note: All the issues below can be resolved with Multiple Protocol Web recorder.

a. While recording, the Single Protocol Web recorder will redirect the client requests to a local proxy, at localhost: 7777. For such, make sure that you have the permission to change the LAN settings of the machine.

To verify:

i. Open Internet Explorer and go to Tools → Internet Options →Connections → LAN Settings.
ii. Make sure that you can modify the entries here.

b. The Single Protocol Web recorder obtains the proxy setting from the HKEY_CURRENT_USER registry hive. Verify the following to make sure that it is set up correctly:

i. Go to Start → Run, and enter regedit to open the registry editor.
ii. Navigate to HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\InternetSettings.
iii. Verify the non-default key, ProxySettingsPerUser. If the
iv. ProxySettingsPerUser value exists and has a value data of 0 (zero), set it to

1. It is okay if you do not have that registry key. As long as ProxySettingsPerUser is not set to one, proxy settings will be obtained from the HKEY_CURRENT_USER registry hive.

1. To make permanent change in default settings in VuGenerator:

To keep from having to change the run-time settings every time that you create a new script, here is an easy way to save your own default settings.
1. Create a new script

2. Make the setting changes that you need to make.

3. Save the script

4. Now, copy the default.cfg file out of the directory of the script file that you just created to the Program Files\Mercury Interactive\LoadRunner\template\{dir}.

The {dir} is whatever directory that you are creating your scripts from. For example, a Web/HTML vuser directory is the \qtweb\ directory. You can also change the init.c, end.c, or action.c if you seem to always have to make changes to these files every time you create a new script.

Set up LoadRunner to run nightly

To get LoadRunner to run nightly required two things. The first was a batch file that would execute LoadRunner and then invoke the analysis and the second was how to schedule the execution on the controller.

The batch file to run LoadRunner at night and to save the results in a specific directory for that nights run is shown below:REM Batch to run nighlty performance test REM REM Thanks to Simon Shepard at http://www.ss64.com for date code REM Calculate today date FOR /f "tokens=6-8 delims=/ " %%G IN ('NET TIME \\%computername%') DO ( SET _mm=%%G SET _dd=%%H SET _yy=%%I ) REM Run LoadRunner "C:\...\bin\Wlrun.exe" -Run -TestPath "P:\Projects\...\PeakHourSmall.lrs" -ResultLocation "P:\...\Results" -ResultCleanName Night-%_dd%-%_mm%-%_yy% REM Run analysis "C:\...\bin\AnalysisUI.exe" -RESULTPATH "P:\...\Night-%_dd%-%_mm%-%_yy%\Night-%_dd%-%_mm%-%_yy%.lrr"

To get the batch file to run as a scheduled task took longer than expected due to some restriction on the PC at work. To overcome this I had to use schtask.exe to schedule the batch.schtasks.exe /create /SC daily /ST 01:50:00 /TR "P:\...\Nightly.bat" /TN RunPerfTest

The nightly LoadRunner test now runs at 1:50 in the morning and the results are waiting when I arrive in the morning.

Saving results of SQL query to a LoadRunner parameter


Here is an example of how to save the results of a query to a loadrunner parameter. In this example I want to know the prod_code for a particular user whos user name is held in the parameter pUserID. To do this you have to add a lrd_ora8_save_col statement BEFORE the fetch statement.

lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm7, 0);
lrd_ora8_stmt(OraStm7, "select indiv,prod_code,last_up_seq from product_users"
"where indiv_uid = '{pUserID}'", 1, 32, 0);
lrd_ora8_exec(OraSvc1, OraStm7, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
lrd_ora8_bind_col(OraStm7, &OraDef9, 1, &INDIVD10, 0, 0);
lrd_ora8_attr_set(OraDef9, CHARSET_FORM, "1", -1, 0);
lrd_ora8_bind_col(OraStm7, &OraDef10, 2, &PROD_CODE_D11, 0, 0);
lrd_ora8_attr_set(OraDef10, CHARSET_FORM, "1", -1, 0);
lrd_ora8_bind_col(OraStm7, &OraDef11, 3, &LAST_UPE_SEQ_D12, 0, 0);
lrd_ora8_save_col(OraStm7, 2, 1, 0, "prod_code");
lrd_ora8_fetch(OraStm7, -1, 15, &uliFetchedRows, PrintRow8, 2, 0, 0);

lrd_handle_free(&OraStm7, 0);

lr_message("The users product code is %s",lr_eval_string("{prod_code}"));

The second and third arguementare the column and row number with the 1,1 returns the value in the first column and the first row, The value is stored in the last arguement. Note that if no value is returned the error will be an unhelpful Parameter is not initialized.

LoadRunner Analysis Importing PerfMon Data

I have recently imported some perfmon data into LoadRunner analysis. First of all I had to use perfmon’s relog command to convert the data into a CSV file.

I then imported this using Tools -> External Monitors -> Import Data. Which leads you to the following dialogue box.



I think this is because I had selected the Time Zone as . So I reloged the data to match the start and end time of the LR results and imported again with the Time Zone set to

Expanding LoadRunner functions


I quickly wanted to get some lr_status message outputted to the console for every LoadRunner transaction in a script, I basically wanted to insert a status message every time the lr_start_transaction was called to output the transaction name to the console. however, it was a large script and I didn’t want to make any code changes to the load runner script. So I wanted to expand the existing function. The code below was added into the vinit section.

void my_start_transaction (char *name)
{
lr_vuser_status_message("Starting Transaction %s",name);
lr_start_transaction(name);
return ;
};
vuser_init()
{

#define lr_start_transaction(x) my_start_transaction(x)

return 0;
}


LoadRunner Function Override

Creating LoadRunner Dynamic Transaction Names


Today I wanted to use parameterized transaction names within a LoadRunner script. As I thought that a particular transaction was failing after a particular number of iterations. Luckily this was pretty simple in LoadRunner. It was just a case of using lr_eval_string in the call to the transaction wrapper.

lr_start_transaction(lr_eval_string("Do Something {pIteration}"));

lr_end_transaction(lr_eval_string("Do Something {pIteration}"), LR_AUTO);

You have to be careful above to make sure that start and end transaction names are the same. To overcome that problem I created a string variable to hold the LoadRunner transaction name.

char sTranName[20];

sprintf(sTranName,lr_eval_string("TransactionA_{pIteration}"));
lr_start_transaction(sTranName);

lr_end_transaction(sTranName,LR_AUTO);

Recording LoadRunner Oracle Forms Object Names

This week I am perforamance testing an Oralce Forms applicaiton. When recording a loadrunner scripts for Oracle forms (NCA protocol) you will want the object / deverlopers name to appear in the scripts to aid readability.

To do this you need to ammend the URL to incude ?play=&record=names. So for the user you need to change the profile. You will need SYSADMIN privileges to do this.

So login and navigate down the tree System Administrator -> Security -> Define



Next select Profile: System



Search for the user you are using for recording and ICX: Forms Launcher



Amend the URL with ?play=&record=names”


Save and then you are good to record the object names with that use.

Excel Macro to read a LoadRunner results and write it to excel sheet | Load runner .MDB file to excel reports generation

Recently my client asked me to get the load runner test reports in excel sheet or Gsheet for their convenience. To develop this i have written an excel macro that reads load runner result file.mdb and generate reports in the excel sheet

Here are the steps:
  1. Open a new or existing Excel workbook, press ALT + F11 to open the Visual Basic Editor.
  2. In the Visual Basic Editor, select Insert > Module to create a new module.
  3. In the new module, define a function that will read the LoadRunner result file. 
Function LoadLRResultFile(FileName As String) As Object
    Dim db As Object
    Set db = CreateObject("DAO.DBEngine.36")
    Set LoadLRResultFile = db.OpenDatabase(FileName)
End Function

This function uses the DAO library to open the LoadRunner result file and returns a reference to the database object. Define a subroutine that will generate the report.

Sub GenerateReport()
    Dim db As Object
    Set db = LoadLRResultFile("C:\path\to\LoadRunner result file.mdb")
    ' TODO: Generate report
    db.Close
End Sub

This subroutine calls the LoadLRResultFile function to open the LoadRunner result file, generates the report, and closes the database.

To generate the report, you can use SQL queries to retrieve data from the LoadRunner result tables and write the results to an Excel worksheet. 

Sub GenerateReport()
    Dim db As Object
    Set db = LoadLRResultFile("C:\path\dev\LoadRunner result file.mdb")
    
    Dim rs As Object
    Set rs = db.OpenRecordset("SELECT * FROM Summary")
    
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets.Add
    
    Dim i As Long
    For i = 0 To rs.Fields.Count - 1
        ws.Cells(1, i + 1).Value = rs.Fields(i).Name
    Next
    
    ws.Range("A2").CopyFromRecordset rs
    
    rs.Close
    db.Close
End Sub

This code generates a report by retrieving data from the Summary table and writing it to a new worksheet. The first row of the worksheet contains the column names, and the remaining rows contain the data. Finally, save the macro and run it to generate the report.

Script to delete unwanted LoadRunner vugen files


Today it was quiet on the performance testing front so I had time to create a vbscript to delete unwanted loadrunner vugen files.

The script is run from the cscript command and will be prompted for the folder for your loadrunner vugen script. It deletes .log, .idx and .txt files and make sure you have closed vugen before you run the script.


On Error Resume Next
Const WINDOW_HANDLE = 0
Const BIF_EDITBOX = &H10
Const BIF_NONEWFOLDER = &H0200
Const BIF_RETURNONLYFSDIRS = &H1
Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'**Browse For Folder To Be Processed
strPrompt = "Please select the folder to process."
intOptions = BIF_RETURNONLYFSDIRS + BIF_NONEWFOLDER + BIF_EDITBOX
strFolderPath = Browse4Folder(strPrompt, intOptions, strTargetPath)

Set fso=CreateObject("Scripting.FileSystemObject")

For Each file In fso.GetFolder(strFolderPath).Files
strExtension = Right(file.Name,4)
If strExtension = ".log" Or strExtension = ".idx" Or strExtension = ".txt" Then
Wscript.Echo file.Name
file.Delete
End If
Next

Function Browse4Folder(strPrompt, intOptions, strRoot)
Dim objFolder, objFolderItem
On Error Resume Next
Set objFolder = objShell.BrowseForFolder(0, strPrompt, intOptions, strRoot)
If (objFolder Is Nothing) Then
Wscript.Quit
End If
Set objFolderItem = objFolder.Self
Browse4Folder = objFolderItem.Path
Set objFolderItem = Nothing
Set objFolder = Nothing
End Function

LoadRunner Unix Time Stamp with milliseconds


I have been working with the SAP WEB protocol this week and needed to generate the windowid which is unix time (time since the 1st January 1970) but including milliseconds. Found this loadrunner function that provides unix time including milliseconds.

web_save_timestamp_param("tstamp", LAST);

lr_output_message("The time is %s", lr_eval_string("{tstamp}"));

Things to correlate in a SAP Web LoadRunner Scipt

I have been doing some SAP web scripting this week and although have been using the SAP Web protocol I have noticed that we still need to do manual correlation.
These are the 3 things I need to correlate:

ClientWindowID e.g WID1339591301202

This is not specifically a parameter that needs correlation but it a value generated in client side JavaScript which is basically the Unix time including milliseconds. Lucky there is a LoadRunner function that generates this. web_save_timestamp_param("pWID",LAST);

sap-wd-secure-id e.g. 30b66c21b9fd11e1bd5f000005ee7aaa5408212193

I have noticed that this parameter does change in some scripts I have written so be careful to extract out appropriately. This is the code I used to extract out the parameter:

web_reg_save_param("pSecureID",
"LB/IC=sap-wd-secure-id=",
"RB/IC=&",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);

wi_id e.g. 000003799238

This parameter appears when a window is spawned.
web_reg_save_param("pWi_id",
"LB/IC=wi_id%3D",
"RB/IC=\"",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);

LoadRunner SAP Web and Certificate problem


I have been recording a SAP Web script this week, on a particular script that crosses different host names (i.e. the host in the URL changes and authentication happens undercover). As we moved to the second host in LoadRunner I was prompted in choose a certificate but the dialogue box did not display any certificates.

To overcome the problem all I need to do was use the fully qualified domain name. This is because that the authentication for the second host is processed using cookies. By not using the FQDN then the appropriate cookie could not be found. A five minute solution for a problem that took days solve

Problem with LoadRunner web_text_link

This summary is not available. Please click here to view the post.

Transferring a LoadRunner license to another machine

 This is the process that I followed. Stress is optional….

1) Obtain the installation files, if you are using the latest version you can get this from the public domain HP website. If you want the preceding version you can get this if you already have a HP passport account and have existing LoadRunner purchases in the last 12 month.

2) Get the Host ID.. Dependent on the version there are different ways of getting the host ID but remember the host ID is tied to the machine and the version of LoadRunner you have installed.

3) Find out your Service Agreement ID (SAID), this is to prove to HP licensing that you have paid the maintance. HP will have provided a PDF file for your service agreements, don’t just pick the one on the top as I did otherwise they might think you want to transfer some QTP licenses. Use the one above the lines detailing the LoadRunner licenses.

4) Phone up the number on the service agreement and raise a request. They will create a service request with the licensing department. You can ask how long it will take but they don’t have a clue.

5) Wait 24 hours and phone back to say you haven’t heard anything. I am told the task has been assigned to a licensing representative. Try not to fill unwanted that the licensing representative hasn’t been in touch, it isn’t personal.

5A) Think no need to panic you left plenty of time to transfer the license.

6) Wait another 12 hours and phone your account manager, but discover they have left the company.

7) Phone his boss, leave a message and wait for him to contact you,

8) Explain to his boss the situation, he says he will find you a new account manager (hope he looks behind the sofa, that where I lose most things)

9) Boss person emails you contact details for new account manager says they will call you

10) Wait for call, wait for call, wait for call then call new account mgr. They explain they are busy because they are trying to close business for that quarter i.e busy selling new stuff rather than servicing those that have already bought. Explain situation and they say they are on the case.

11) Start to panic because it shouldn’t take this long and testing will be starting soon. You don’t want to start late you are going somewhere nice in a few weeks and want to get the testing complete before you go…

12) Get email from licensing guy saying you have given them the wrong service agreement ID (see note 3)

13) Send email in Morning with correct service agreement ID

14) Get email in afternoon from account manager asking why I haven’t sent the service ID. Check your mailbox and see that the email was sent… Strange sometime it feels someone is telling you something.

15) Resend email with correct SAID

16) Spend weekend worrying if license will arrive in time for testing

17) Mid morning get an email saying we need to establish what protocol groups we need. Got to admit I expected for a license change HP would know what we had and it would be tied to the service agreement. Luckily they can generate a tempory license If I tell them was protocol groups we need. Reply saying what protocol groups we need

18) 10 mins later you get the license key

It took a week from raising the request to a complete license. So, the moral of the story leave plenty of time for a HP LoadRunner license transfer…

Least I had my Mercury Interactive stress ball to help me through the process. The irony is that it was never this stressful dealing with MI.

Playback LoadRunner through Fiddler


If you are concerned that your LoadRunner script is not emulating user behaviour correctly and want to make sure it is download all the correct files etc, then you can connect LoadRunner to Fiddler and play the script so that fiddler captures the HTTP calls. For those that don’t know Fiddler is a debugging proxy that captures and displays the HTTP requests between a browser and the server (it does more but that is a quick summary). An example output is shown below:




You can then run VuGen or (don’t do it at load) through the controller by setting the proxy under runtime options.


Scripting for ODBC Protocol in LOADRUNNER

Developing scripts for a Client Server Application with SQL Server as Database. The protocol license the Client has license for MS SQL SERVER Protocol.

1. Installed application on Machine A. installed SQL Profiler on Machine B (DB server)

2. Started the SQL Profiler:
Program files> Microsoft SQLSERVER 2005>SQL Profiler>;OpenSQL Profiler>File>New Trace>connect to the DB server

3. Trace Properties window appears:
Genraltab>Enter Trace Name: xxx>Use Template: TSQL_REPLAY>Savetofile:givefilename
Events Selection Tab>click column filters>Inedit Filterwindow-SelectHosttName-Like: (Hostname of the Machine on which the applications hosted) > click OK > Then Click RUN.

4. Perform the User actions on Machine A. They are recorded in Machine B(DB Server). on which the tracing is enabled.

5. Select each Trace file and convert into T-SQL scripts. How? see belowgoto file( in SQL Profiler)>Export>Extract SQL Server Events>Extract transact SQL Events> save them

6. Then copy the content of the T-SQL file to a precreated Loadruner script in ODBC Protocol.
Example of the skeleton of ODBC Loadrunner Script will be given below.

7. If you execute the script it will not work.

8. To execute the script, setup ODBC connection in the machine on which the script is being executed. HOW? See Below
Go to control Panel> Administrative tools>click DataSource ODBC> Add SELECT: SQL Native client
NAME/Description and server: Enter the Server Name> Enter :UserName/Password.

9. Now the ODBC Script is ready to be executed

10. Convert MSSQL Loadrunner script to ODBC Script other wise it will not run in controller due to the license issue.

Skeleton of ODBC Script:

lrc_open_context

lrd_alloc_connection

lrd_openconnections

lrd_open_cursor

lrc_stmt

lrd_exec

The content of the Trc file goes here:

lrd_close_cursor

lrd_close_connections

lrd_free_connection

lrc_close_context

Web Resource Graphs in Load runner analysis

Retries per second:
  • No of attempted Server connections
  • A server connection is required-When an initial connection could not be made
  • When an initial connection is shutdown by Server
  • When an initial connection is unauthorized by Server
  • When a proxy authentication is required
  • When server could not resolve load genrator’s IP address
Connections per second:
  • Number of TCP/IP connections opened
  • Number of Connections Shutdown. No of connections is fraction of hits/sec
  • TCP/IP connections are expensive interms of server, router and network resource consumption. So HTTP request should use same connection instead of opening new connection each time of each request.
SSL connections per second:
  • No of SSL connections opened per second
  • After TCP/IP connection SSL connection is opened.
  • SSL connection has heavy resource consumption.
  • If we select simulate new user at each iteration then there should not be more than one SSL connection per sec

JAVA RMI Protocol in LOADRUNNER

1. When I clicked some links on the Web Application, I saw an applet showing ' "JAVA LOADING". This tells us that JAVA WEB START is used to launch an applet

2.JAVA WEB START could have been implemented with a HTTP or JNLP protocols
In this case the developers are using JNLP Protocol.

3.JNLP Protocol(Java Netwrok Launch Protocol)- Using Java Web start the stand alone Java application can be deployed with single click over the network. Java web start ensures the correct version of the Application and JRE are installed on the fly.

But the Loadrunner is not having that environment setup so it cannot record "Applet part of the application.

1. Get Developer fill the RMI/CORBA Qualifier

2.When the application is lanched, I found that the application jar files aresome where in my local machine. I copied them to a temporary folder called , "JARS"

4. Created a batch file to launch Loadrunner with below class paths

********************Batch files Start********

set Classpath = c:\Progra~1\Mercur~1\Merc~1\Classes;

c:\Progra~1\Mercur~1\Merc~1\Classes\srv;

c:\JARS\Mercur~1\file.jar...........all jarfiles;

set path = c:\j2sdk1.4.2_09\bin;

c:\Progra~1\Mercur~1\Merc~1\bin;

c:\winnt\system32\wbem;

c:\winnt;

c:\winnt\system32;

set -java_options = -xrunjdkhook-xbootclasspath/P:C:\progr~1\Merc~1\classes;C:\progr~1\Merc~1\Merc~1\classes\srv;

start VUgen
************Batch File End*********************

Application records Successfully but wont Replay

Why?

ToReplay run this Batch file
********************Batch files Start***********

set Classpath = c:\Progra~1\Mercur~1\Merc~1\Classes;
c:\Progra~1\Mercur~1\Merc~1\Classes\srv;
c:\JARS\Mercur~1\file.jar...........all jarfiles;
set path = c:\j2sdk1.4.2_09\bin;
c:\Progra~1\Mercur~1\Merc~1\bin;
c:\winnt\system32\wbem;
c:\winnt;
c:\winnt\system32;
start VUgen
************Batch File End*********************

Now I could able to replay the script successfully
NextI have to enhance the script-
Here when I launched the application it is Web then omesto Java applet.
to run the script using Loadruner-JAVA RMI Protocol, I have to convert the Recorded Web Piece of code in the loadrunner script in to JAVA.
I did the following experiments
1. Handling the Web Part: When applicatis launched through the Web, some tokens are used. I have to correlate those tokens fisrt. To do that I recorded again the application in with Loadrunner Web(HTML /HTTP) Protocol and correlated with classic Web_reg_save_param function.
2. Then converted that code of the web Script in to Java and appended it at the top of the script I recaorded earlier with JAVA RMI Protocol.
3. How did I convert the Web Script to JAVA?..... Record the appliation in Web Protocol. Copied the code in text file. In the command prompt I used SED utility
**************************In the CMD Prompt***************
loadrunner/bin/>sed-f web_to_java.sed c:tmp/web.txt>c:/tmp/java.txt
but error occured. then tried
loadrunner/bin>sed -f lrconvertweb.sed c:/tmp/web.txt >c:tmp/java.txt
again error
Then I made sure Loadrunner\bin is in the systems path environment. Then I opened command line and tried following
sed -f web_to_java.sed c:/tmp/web.txt >c:tmp/java.txt
It worked successfully
I copied the content of the java.txt and appended at the top of the Loadruner script recorded in JAVA RMI Protocol.
Then I paramerized the token numbers and used it to handle the correlation in the JAVa RAMI Script.
Then Make these changes to the Runtime settings because the Internet Protocol section is missing in the JavaRMI Scipt. I tried the following:

1. Close VUGEN--- Goto ,LoadRunner>dat\protocols, There edit the .lrp file

2. Locate the the[VUGEN] Section, for the data for CFG_TAB_DLL=, add a comma and LRW Runtimesettingd UI.dll to it.

3. To put Text checks in JAVA RMI Script( similar to WEB_reg_find in Web Protocol) I wrote some Java code to validate the Transactions

For example: In the Script When user click a button, the server genrated confirmation number is found in JMS.txt inVugen folder. I could not find it in the recorded script. It should be captured to validate the Transaction. I wrote some Java code to validate. Here the application is using"JMS Messaging with call back section.

My experiments before recording:

1. Manually Launched the application

2. Install Correct version of JDK.---but not starting

3.Tried deleting the folders created by previous launch. It started

4.If not, comment out the -java_options in the environment varialbes/classpath. also remove -xrunjdkhook from the Java environment parameters given in java plugin options
It will start successfully. If not the browser crashes

5. I saw cache exception in Java console while launching the application. Then I unchecked enacle caching in JavaPlugin from control pannel

These are the experiments I did with Load Runner RMI Protocol. I hope these experiments will help some one in working with Loadrunner JAVA RMI Protocol.

Converting a String from HTML to URL format in LR

I need to correlate a string in LR script which is in below format
u4yxAKJcJkcHw7ou%2BagbvBykfJqrjFlgu4QHZw%2FAY1w5eBs0j2cPwaC%2Bo7KQfbYHvZsat

But using web_Reg_save_param() function I could only capture in this format
u4yxAKJcJkcHw7ou+agbvBykfJqrjFlgu4QHZw/AY1w5eBs0j2cPwaC+o7KQfbYHv

The issue is the captured string has "+" spaces inbetween. I have to convert the "+" to something like "%2B"
basically from HTML format to URL format.

After correlation. I used web_convert_param() function to convert it to URL. passed it to a parameter and used that parameter to replace the hardcoded string

Please see below picture:

Loadrunner Controller issues

Below are some key facts to remember about controller. (Note: I am publishing some of these issues from my notes which I encountered at different times. I am just consolidating them here.)

The Maximum number of threads for driver. The number of threads per driver has been internally set for each specific protocol.

Increasing Vuser Limit:

You can increase the Vuser limit on Windows NT by modifying the load generator's Windows Registry as follows:

Open the Windows Registry.

Select Find>Data and search for the term "SharedSection".

This search should return a path similar to this:

MyComputer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Session Manager\Sub Systems\Windows

Modify the second value to 4096. 

Run-time settings -
When you modify a script's run-time settings in the Controller, the new settings are saved with the Controller scenario. If, you open the script in VuGen and modify the run-time settings, use the Refresh button in the Controller to see the new settings.

Compiled Vusers -

When the Vuser script is a compiled Vuser, the Controller doesn't send the dll to the remote machine.
Workaround: Add the dll to the list of script files. In the Controller Scripts tab, right-click on your script name and select Details. In the Files tab, click Add and point to the dll. This will add your dll to the list of files to be transferred with the script.

You may receive the following error message when launching the Controller: "Cannot install license information, probably access to system resource was denied." This indicates that you need to log in with administrator permission, since you installed the product with administrator permission.

Workaround: Run setlicensepermissions.exe from the LoadRunner bin directory to change the registry permissions.

Environment variables on load generator machines - If you change the value of an environment variable on a load generator machine and you configured the load generator to automatically run virtual users, restart the machine to use the new value of the environment variable.

Output window - Keeping the Controller Output window open for long periods of time will affect the machine's memory usage.

VB Script VUser Protocol - Essbase Hyperion Application

Recently I had a challenge with Essbase Hyperion application. Application Characteristics: One should install Essbase Client on their machine and should have MS Excel 2003/2007.

The communication to the DB happens via excel. Essbase client appears as Addin from Excel. I could not use Oracle 2 tier or ODBC protocols. The communication to the dB is not via SQL queries.

Then I tried Winsock. I could able to develop a script but building scripts for mutliple drill downs that client requested became a pain.

So adopted VB Script VUser Protocol and I could successfully able to run the tests in PC11. If you want to know how I could able to build scripts for this application please go through this document.

Analysis - Comparing data from LoadRunner Graphs with Raw Data

The below post includes what kind of questions a Performance Engineer may encounter during Analysis session for a detailed oriented and curious client.

Performance Engineer:
I provided the Transaction Response time summary Report and shown different Graphs to the customer

Client:
I would like to have the raw transaction times (number shown in "Pass" column). This means a Transaction passed for 50 times during the test, they want to see the response times of each of the 50 passed transactions.

Performance Engineer:
I provided the Response Times of the two transactions client requested with time stamps.

Client:
What is the difference between first Buffer Time and Over All Response time?

Performance Engineer:
The First Buffer Time is always less than the Overall Response time
what we see in the Response times graph is the TIME When Response Completed. It will be obviously more than that of First Buffer Time.
Please refer the below diagram.


Client:
Thank you for the raw data and the above explanation  Could you please verify that all data points were    included as I cannot match the numbers in the spreadsheet? On the spreadsheet it shows that there were 19 data points for the Transaction1 and 18 data points for Transaction2 yet only 17 data points are available for each in the Raw Data why?

In addition, I cannot see the corresponding entry that matches the value of the maximum number displayed in the summary spreadsheet for either transaction.

The only number that I can currently match is the minimum number. Please let me know if there are other data points that need to be included.

Performance Engineer:
I provided the raw data for the login the Graph. Now I am getting you the Real Raw data from data points.

There is a difference between these two raw data (Real Raw data and Graphed Raw Data)
For Example: In Real raw data, you see two values at 36 seconds. During that 36th second of the Test run two users took 26 sec and 23 seconds respectively.

The Graphed Raw data shows the average of these response times that happened at fraction of seconds. (Because our granularity is only 1 second We cannot go more granular than 1 second)
Average of 26.738 and 23.211 = 24.975. This is what you are seeing in the Graph and But in summary you are seeing 26.738. This value is based on Real Raw data.



Coming to the question, Why we are not able to map the max values to the Maximum data point in Summary? The Web Page component Break down graph is also Average of different users activity at different point. So if you try to map the Max value in Summary with Max value in Web Page Break down Graph we are not mapping same values. Because, they might not occurred at the same time.

What the Response Time Summary shows is pretty much clear. 90 percentile shows how many transactions are below that particulat data point. If the 90 percent column is exceeding your SLA, then we have to correlate it with the Standard Deviation. If deviation is high. Then we need to go to the specific Graph and observe the trend to see where the deviation occurred.

Difference in Response times with Different LoadGenrators. Why?

I recently encountered this issue and the below solution fixed this issue

Issue:
The response times of transactions for the users generated from a Load Generator on Windows 2003 are lower then the response times of the same transactions from Users generated from a Load generator on Windows 2008 R2

Solution:
Perform this on Load generator on Windows 2008 R2

1. Control Panel> User Accounts >Turn User Account control on or off> Uncheck the Check Box with Name: User Account Control Box On to protect your computer

2. Add SSL Certificate:

a. Go to Fire Fox that is in the Bin dir (if it is for Ajax True Client)
b. Open it> Tools > Options>Advance>View Certificate> Add Certificate
c. How will I get Certificate?
Play the application manually on this box. Then certificate may be downloaded in that location.

3. Turn Off Fire Wall

WINSOCKET PROTOCOL IN LOAD RUNNER

When your application is not supported by any Loadrunner protocols. Since most network protocols use Winsock an interface, we would be able to capture almost all application on Windows if we record at theWinsock layer. So we use Winsock when other protocols do not work.

The Below Document shows how to build a Winsock Script with Loadrunner. I also included some Tips and Tricks while using Winsock Protocol



Tips and Tricks
  1. Winsocket in multi-protocol mode does not support UDP.
  2. Winsocket in single-protocol mode does not support asynchronous calls.
  3. You may encounter problems recording in Winsocket, Winsocket/Web or Oracle NCA.
  4. Workaround: Modify the registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\BrowseNewProcess and make sure that the string value BrowseNewProcess is set to yes. This causes IE to open a new process. If this workaround doesn't work for the Windows2000/2003 server, add the argument "-new" to the Program to Record. This causes IE to open a new process.

Function to write current system Time

This main use of this functions to return the current system time at any given
point of time while load runner script is running.This functiona can be used to
report transaction times , script starti time and end time.

long get_secs_since_midnight(void)
{

char * curr_hr; /* pointer to a parameter with current clock hr */
char * curr_min; /* pointer to a parameter with current clock min*/
char * curr_sec; /* pointer to a parameter with current clock sec */
long current_time, /* current number of seconds since midnight */
hr_secs, /* current hour converted to secs */
min_secs, /* current minutes converted to secs */
secs_secs; /* current number of seconds*/
curr_hr = lr_eval_string("{current_hr}>");
curr_min = lr_eval_string("{current_min}");
curr_sec = lr_eval_string("{current_sec}");
hr_secs = (atoi(curr_hr)) * 60 * 60;
min_secs = (atoi(curr_min)) * 60;
secs_secs = atoi(curr_sec);

current_time = hr_secs + min_secs + secs_secs;
return(current_time);

}

Then these two lines are enough for getting current time.

lr_save_datetime("Today is %H %M %S", DATE_NOW, "curr_time");
lr_output_message(lr_eval_string("{curr_time}"));

lr_save_datetime function in Loadrunner

LoadRunner stores date/time parameters locally on the LoadRunner PC. This means that opening a script on another users PC, where the date/time parameter is not stored, can cause corruption to the date/time parameters in a script. You know that this has happened when a date/time parameter in this format [%Y%m%d%H%M%S] is sent to the server rather than the format that you intended.

Due to this problem, It is recommend that the lr_save_datetime function is used to save date or time values to a string. The string can then be used in the script and the script is portable between PCs because we are no longer relying on the locally stored parameters.

Sample code

lr_save_datetime("%d/%m/%y", DATE_NOW, "DDMMYY");
lr_output_message("Today's Date is %s",lr_eval_string("{DDMMYY}"));

lr_save_datetime("%d/%m/%Y", DATE_NOW, "DDMMYYYY");
lr_output_message("Today's Date is %s",lr_eval_string("{DDMMYYYY}"));

lr_save_datetime("%B %d %Y", DATE_NOW, "Today");
lr_output_message("Today is %s",lr_eval_string("{Today}"));

lr_save_datetime("%B %d %Y", DATE_NOW + ONE_DAY, "Tomorrow");
lr_output_message("Tomorrow is %s",lr_eval_string("{Tomorrow}"));

lr_save_datetime("%A", DATE_NOW - ONE_DAY, "Yesterday");
lr_output_message("Yesterday was %s",lr_eval_string("{Yesterday}"));

lr_save_datetime("%A", DATE_NOW, "Today");
lr_output_message("Today is %s",lr_eval_string("{Today}"));

lr_save_datetime("%A", DATE_NOW + ONE_DAY, "Tomorrow");
lr_output_message("Tomorrow is %s",lr_eval_string("{Tomorrow}"));

lr_save_datetime("%X", TIME_NOW , "Time");
lr_output_message("The time is %s (in this locale's date format)",lr_eval_string("{Time}"));

lr_save_datetime("%X", TIME_NOW + ONE_HOUR , "Time");
lr_output_message("In one hour it will be %s",lr_eval_string("{Time}"));

lr_save_datetime("%A", DATE_NOW + ONE_DAY, "Tomorrow");
lr_output_message("Tomorrow is %s",lr_eval_string("{Tomorrow}"));

lr_save_datetime("%j", DATE_NOW, "Today");
lr_output_message("Today is day %s in the year",lr_eval_string("{Today}"));

lr_save_datetime("%Z", DATE_NOW, "TimeZone");
lr_output_message("This machine is in the '%s' time zone",lr_eval_string("{TimeZone}"));

lr_save_datetime("%p", DATE_NOW, "AMPM");

if (strcmp (lr_eval_string("{AMPM}"),"PM")!=0)
{
lr_output_message("Good Morning");
}
else
lr_output_message("Good Afternoon");

Impact of Threadpool Architecture on Application Performance

During the performance Test, the web application is tested to respond in a timely and reliable manner to
simultaneous service requests. The response times of the transactions of these multi threaded applications depend up on thread pool architecture.

Creating and destroying a thread is expensive. It requires run-time memory allocation and deallocation.
These overheads may shutdown the system during high loads.

To minimize the overhead of thread creation and destruction, threads in the pool are reused during multiple requests and the creation and destruction of the thread is minimized to only once per thread not once per request.

Efficient thread management for a given system load depends on Thread pool size.

If thread pool is too large: there will be more unused threads --> idle threads increases then busy threads --> contextswitching increases --> processing and memory resources are wasted to maintain the thread pool

If the thread pool is too small:during peak loads, additional threads must be created and destroyed on the fly to handle new requests-->It requires run-time memory allocation and de allocation.

This causes overhead on the application and impacts the performance and may shutdown the system during high loads.

SAP BUSINESS OBJECTS [SAPBO] PERFORMANCE TESTING

This post explains how SAP BI performance testing is conducted to validate the performance of the the BO reports.

This post explains:
How to login to SAP Business Objects and create reports?
How to design a loadrunner script to simulate the above process for mutliple reports with multiple security groups in a Business Objects Universe.

Business Objects Login
1. Launch the SAP BI URL


2. Business Objects login screen will be displayed

3. Enter your user name & password in the boxes and select Windows AD from the drop down list of Authentication.
User name:
Password :
Athentication : Windows AD 

4. Click on Log on and you should be able to see the Business Objects Infoview page

5. Click on the Document List button to go to Navigation page.

6. Once you click on the Document list the navigation page will be opened

7. My Favorites folder in the navigation page is the user personal folder. Reports saved under this folder are accessible to user only and not visible to other users. Public Folders in the navigation page is the folder accessible to all the users. 8. To open the existing reports under Public Folders, navigate the folder under it and click on the folder name. All the reports available under it will be seen on the right side of the screen and double clicking on the Report name will open the report.

Creating a Business Objects Report
1. In the Navigation page, select Web Intelligence Document under the drop down list of New
2. Depending on the user access, list of universes will be displayed. Select the universe by clicking on the Universe name to develop a report.
3. Once you click on the universe, query panel will be opened with all the universe dimensions
There will be three sections in the query panel.
Data tab: Left side of the panel is called data tab and shows the universe objects.
Result Objects: This section is used to include data in the report. To include data, select objects from the data tab and drag them here and click Run Query to return the data to the report.
Query Filters: This section is used to filer the query. To filter the query, drag objects here and then use the Filter Editor to define custom filters.
4. To develop a report, select objects and drag them to Result Objects section.
5.Click on the Run Query to return the data to the report
Report with selected data will be displayed
To add filter conditions to the report, go back to query panel by clicking on Edit Query button.
6.Drag and drop the object you want to apply filter on in Query Filters panel.
Select the filter condition from the drop down list
Enter the value OR select the Type of values from the list
7.Selecting Values from the list will display the values of the object to be selected.
select the value from the list and click on ‘ > ‘ button and click on ‘ OK’.
8. Click on the ‘Run Query’ button (available on top right corner of the page). This returns the data filtered by Node Description. 9. Reports can be saved to excel or pdf by selecting the option from save button(available on top left corner)

Requirements: The client wants to know
The response times of mutliple BO Reports for each security group.
Want to see response time of each report for every security group. The name of the security group should appear on each Transaction Name.
Quantity of the reports are in around 70-100 and security groups are around 6-9

Design:
In this case the script should be designed in a efficient way by considering following standards
Naming Convention.
Create a single script by consolidating mutliple scripts and writing functions. This makes script manitenance easy.
Apply inheritance - Write functions and use them in the script in multiple areas where ever required. In this way we can minimize script lenghth.
We see more dynamic data in these kind of applications identify and apply correlations in efficient way.
Precausion should be taked while creating Parameter file and while calling the parameters

Below example shows how a Load runner script is developped for SAP BO reports.

It concatinates the security group name(Utype) of the each user in the parameter file along with the transaction Name.




In SAP BI, There might be some prerequisite you should consider before running a script. below are some I had to do. 



The users are differentiated by passing a new parameter value, "User type"






The script executes 5 iterations. During each iteration it randomly picks one report and executes

How SAML -Open SSO works?

Example: A user logs into an application A and then clicks a link from Application A. Then He see information he is expecting from application B. when we simulated this transaction from load runner. The response time of the link is too high.

when I analyzed the communication of the click. I found the complete design behind the link.
and thought of implementing some component leve performance testing measure the latency of LDAP and SAML communication.

These two applications A and B can be B2B applications protected by firewalls of the respective clients. To pass information these two clients is a challenge. This issue is addresses using SAML and LDAP.

SAML is an XML standard for exchanging security-related information, called assertions, between business es over the web. The assertions can include attribute statements, authentication, decision statements, and authorization decision statements.

LDAP, the Lightweight Directory Access Protocol, is a protocol used to access a directory listing.

In the above example,

User Login to the Application A which is firewall protected by business A.
Then he clicks a link.
SAML Encrypted token is generated
This is posted to a url of Business B Https://XXX.businessB.com in encrypted format
The OIF which is associated with This URL Picks the encrypted SAML Token
OIF does the following
Decrypts this Token
Verify Signature
Finds SSN.
It uses SSN to find Userid. To find the userID using SSN, LDAP is used.
Identifies user associated with the SSN

OAM comes in to Picture here. OAM Logs the user into the Application B and creates a new Session

as all these tasks are happening behind the scenes the response time is little higher than a normal clicks.

I will explain in the next post How I conducted performance Testing to find the response times of SAML communication and LDAP.

Creating Data For PeopleSoft in Load runner

When working with Peoplesoft GL application, I have to create multiple LR scripts to create data to support the performance testing. In the below example, I created a small script that creates Ledger Files with 5000 lines so that I can import them in to Peoplesoft GL module via a macro enabled spreadsheet. I used basic C functions to create this script. This sample script template can be leveraged to us create text files in multiple ways.

LoadRunner 11.50's licensing mechanism has changed

If you're like me and can't wait to have the latest and greatest version of software on your machine, you should be aware that, unlike previous upgrades, LR 11.50 has been modified to requires a new license.

Since current LoadRunner users cannot continue to use their existing licenses, you will need to generate a valid new one.

To Request a License

To Request a License you'll need to:
Navigate to:https://h20575.www2.hp.com/usbportal/fulfillment/selectedProducts.do?lc=EN_US&said

Select your SAID number, click and LoadRunner under 'Products' and click 'View available products'



Select LR 11.50 and click 'Get Software Update' button



You should now have a tab option for 'Get Licensing'




LR 11.5 Protocol Bundles

If you're requesting a new license, you should also be aware of what the protocol bundles for LoadRunner 11.5 and Performance Center 11.50 are:
Bundle Name
Protocols Included
.Net Record/Replay
Microsoft ADO.NET
Microsoft.NET 2.0, 3.0, and 3.5
WCF (Windows Communication Foundation)
Database
Microsoft SQL Server
ODBC
Oracle(2-tier)
DCOM
Microsoft COM/DCOM
GUI Virtual Users
HP Functional Testing(Quick Test Professional)
Java Record/Replay
CORBA-Java
Jacada
Java over HTTP Vuser

JMS
RMI-Java (Includes ORMI)
Network
DNS
FTP
IMAP
LDAP
MAPI
POP3
SMTP
Tuxedo
Windows Socket
Oracle E-Business
Oracle NCA
Oracle Web Application 11i(Click and Script)
PeopleSoft Enterprise(Click and Script)
PeopleSoft-Tuxedo
Siebel-Web
Remote Access
Citrix Virtual User (ICA)
Terminal Emulation(RTE)
Remote Desktop
RDP
Rich Internet Applications
Action Message Format (includes RTMP/AMF)
AJAX Click and Script
AJAX TruClient-Firefox

AJAX truCLient-IE
Flex Virtual User
Silverlight Vuser
Mobile TruCLient
SAP
SAP Click and Script
SAP GUI
SAP-Web
SOA
MQSeries-Client
MQSeries-Server
Service Test Vuser
Web Services
Web 2.0
Web and Multimedia
RIA and SOA combined
Web and Multimedia
Media Player (MMS)
RealPlayer
Web (Click and Script)
Web(HTTP/HTML)
Mobile Applications Protocol
Wireless
i-mode
MMS
Palm
WAP