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 scenario file

Doing some performance testing on site this week where there is only one LoadRunner controller. That was in use and I wanted to see the number of virtual users for each script set up in the Loadrunner scenario file (.lrs). So I wrote this Excel Macro to provide the data.

It prompts for the scenario file (.lrs) and then parses the file to list out the group, script name and the vuser count.

This is a bit of quick and dirty code and I am sure it will develop as it sees different scenarios but I thought I would share it with you.

Sub ReadALRScenario()

Dim sFileName As String
Dim iFileNum As Integer
Dim sBuf As String

' edit this to your defaul directory:
sFileName = "C:\Users\pengland\Documents\Projects\"

NewFN = Application.GetOpenFilename(FileFilter:="LoadRunner Scenario, *.lrs", Title:="Please select a file")
If NewFN = False Then
' User Pressed Cancel
MsgBox "You need to select a valid file"
Exit Sub
Else
sFileName = NewFN
End If

' does the file exist? simpleminded test:
If Len(Dir$(sFileName)) = 0 Then
MsgBox ("Can't find file")
Exit Sub
End If

Range("A1").Select
Row = 0

iFileNum = FreeFile()
Open sFileName For Input As iFileNum

Do While Not EOF(iFileNum)
Line Input #iFileNum, sBuf
'Now you have the next line of the file in sBuf
'Capture UiName
If InStr(sBuf, "UiName") > 0 Then
UniName = Mid(sBuf, 8, Len(sBuf) - 7)
End If

If InStr(sBuf, ".usr") > 0 Then
LastOcc = InStrRev(sBuf, "\") + 1
Length = Len(sBuf) - InStrRev(sBuf, "\") - 4
ActiveCell.Offset(Row, 0) = UniName
ActiveCell.Offset(Row, 1) = Mid(sBuf, LastOcc, Length)
ActiveCell.Offset(Row, 2) = -1

Row = Row + 1
End If
Loop

' close the file
Close iFileNum

'For Each Script count number of =script names in thr file

NumOfScripts = Row - 1
Row = 0

Do While Row 0 And (Len(sBuf) - 1) = Len(SearchString) Then
ActiveCell.Offset(Row, 2) = ActiveCell.Offset(Row, 2) + 1
End If
Loop

' close the file
Close iFileNum

Row = Row + 1
Loop

End Sub

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);

Problem with LoadRunner web_text_link

I was passed a LoadRunner script developed on v11 for execution on a v11.5 installation. On execution of the script in the LoadRunner VuGen or the controller it failed on web_test_link. Tracing the error back the preceding web_test_link was not execution correctly so the web_test_link was not able to find the text of the link it should be clicking.

The failing script was aborting the download:


However, for various other reasons we had to regress the LoadRunner installation back to v11 and without any change to the script it worked… 

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

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.