Friday 2 December 2022

How to find the number of times that a string occurs in the server response in NeoLoad?

You can create a variable extractor to find the string/pattern and extract all occurrences and place them in a variable, once done you use the Variable_matchNr as the number of times to loop.

Example for MatchNR Condition:



Thursday 17 November 2022

Script version is newer than TruClient version | Script version (12.62.703.0) is newer than TruClient version (12.55.1333.0)

A script cannot be run on an older version if it was created on a more recent one. Because Truclient does not provide forward compatibility, this occurs as shown in below.


 A script cannot be run on an older version if it was created on latest version. Upgrade Vugen to the latest version required by the script, or record the script on the most recent version is the only solution to it.

Friday 16 September 2022

Active screen Error in Load runner | "Please enter the User Name and Password to be used when accessing password protected pages in the Active Screen."

Sometimes when you replay your vugen script or stop the replay, you may see the active screen error pop up or the error "Please enter the User Name and Password to be used when accessing password protected pages in the Active Screen." or you may keeps getting ActiveScreen dialog box.


To resolve this we have below solutions:

Method 1: Set the Internet Explorer to not prompt for a Certificate. 

  • Go to Internet Explorer --Tools-- Internet Options -- Security tab
  • For the Local Intranet and Internet, Hit Custom Level--Enable "don't prompt for client certificate selection when no certificates or only one certificate exists..."--Close the browser and run the script.

Method 2:

  • Go to run-time-setting--preferences--Check-in WIninet replay instead of Socket(Window only)
  • Go to run-time-settings--preferences--options-- take value yes for Authentication: use window native NTML implementation and override credentials in window native implementation
Method 3:

  •  In VuGen Disable the Runtime Viewer 
  •  Go to Tools--General options --Display --and uncheck "Show browser during replay"
  • When the script is load tested in LRE or Controller, by default Runtime Viewer is disabled. so you may not see this error there.
Method 4:
  • Open the registry (Start Menu -- run -- regedit)
  • Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microfocus\Interactive\LoadRunner\Vugen\Thumbnails
  • Set the GenerateThumbs key to 0 (the default value is 1)

Thursday 15 September 2022

Get the current iteration number in neoload | iteration number in neoload using javascript

You can get the current iteration number using the NeoLoad Javascript API.

context.currentVU.getCurrentIteration();

Unless your test is run iteratively, in which case you may predict the final iteration number, you cannot know the last iteration.

Friday 2 September 2022

How to Clear the Cache and Cookies in Neoload | web_cache_cleanup(); & web_cleanup_cookies() in Neoload

In general for clear cookies and cache in your we use the functions web_cache_cleanup(); & web_cleanup_cookies();. The same we can implement in NeoLoad script with a simple java script. just add these below 2 lines in your java script and run the script.



context.currentVU.clearCache();

context.currentVU.clearCookies();

Monday 29 August 2022

Free LoadRunner download | Micro focus Load Runner free trail version download

Previous links were not working for free download of Vugen and Analysis tools. We can download the latest software trails from the below link. We now have a gated access to LRP community edition. You can sign up to get access using this link.

https://www.microfocus.com/en-us/products/loadrunner-professional/free-trial

When you finish, Micro Focus team will send you the download links. You will discover that the software has a community license built in when you download and install it. To verify this, launch the LR license utility. Please be aware that the community bundle license is only intended for use in the development of tests and the execution of proof-of-concept projects. All protocols—aside from COM/DCOM, templates, and GUI Virtual Users—are included in this community bundle. Commercial usage of the community package is expressly forbidden and it is given without any type of support or warranty.

Sunday 28 August 2022

What is Wasted Time ? | LoadRunner Vugen Wasted Time

In order to distinguish between actual time spent on processing and displaying information and human/idle-waiting overhead, the idea of Wasted Time was established.. Wasted time is calculated as a factor of unnecessary waiting. Your script can also add wasted time with lr_wasted_time() function.

For Web http html script, the time taken for web_reg_find or web_reg_save_param functions to look for a particular string in the response buffers, is counted as wasted time. The transaction time includes the ''wasted time'' but it is subtracted from transaction time when displayed in Controller and Analysis.

The wasted time does not include the time spent writing the Vugen log file and the Vuser log files. The actual elapsed transaction time is increased by the logging time. The function lr get transaction duration() returns the real amount of transaction time that has passed. The analysis and creation of test scripts may benefit from this knowledge.

You can retrieve the total wasted time (both that generated automatically and that added with lr_wasted_time) with the function lr_get_transaction_wasted_time(), or with lr_get_trans_instance_wasted_time(), as appropriate.

Saturday 27 August 2022

Write transaction responses to a text file in Vugen Load runner | Capture transaction response times load runner | Capture and display the response times from replay log vugen LoadRunner

If you want to write the transaction response time to a file in Vugen, you must use the function lr_get_transaction_duration(). The lr_get_transaction_duration function returns the duration in seconds of the specified transaction to this point. You use this function to determine the total transaction time before the transaction has ended. lr_get_transaction_duration returns values greater than zero only for open transactions. Here is the code to copy the transaction response time and display it to the replay log.

SAMPLECODE:
Action()
{

        double trans_time;
        int status;
    
        web_cleanup_cookies();       
        web_set_sockets_option("SSL_VERSION""TLS1.2");
        web_set_max_html_param_len("999999");
                             
        
        lr_start_transaction("Digital_HondaCity_01_HomePage");
            
     web_url("AirVistas"
        "URL=https://Airvistas/service/access/findseat/"
        "TargetFrame="
        "Resource=0"
        "RecContentType=text/html"
        "Referer="
        "Snapshot=t10096.inf"
        "Mode=HTML"
        LAST);  
     
          trans_time = lr_get_transaction_duration("Digital_HondaCity_01_HomePage");
          
          lr_end_transaction("Digital_HondaCity_01_HomePage",LR_AUTO);
        
                     
         if (trans_time)
         lr_output_message("The duration of DHC Home Page : %f seconds", trans_time);
         else
         lr_output_message("The duration cannot be determined.");
          return 0;
}

Here is the output:


If you want to copy this duration to a file ,Please follow the below link.

Friday 26 August 2022

NL-NETWORK-01 error in NeoLoad

Error detected by NeoLoad

Error Code: NL-NETWORK-01
Message: Network error: An IO error occurred sending the request.
Details: java.net.SocketException: Network is unreachable: no further information     

This is an Miscellaneous I/O error when connecting to the server . When you see this error, immediately check the https URL that you are using for your request. It may be wrong URL or having some typos in it or may the server end the app is down. Once you correct it and replay it should work.

Thursday 25 August 2022

NL-NETWORK-02 BindException errors in Neolaod | Neoload NL-NETWORK-02 error

When you are running a load test on NeoLoad sometimes you may see the NL-NETWORK-02 "BindException" errors, Typically, this occurs because the system's socket creation capacity has been reached by the load generator. Therefore, it is necessary to change the system TCP/IP settings. Windows computers frequently experience this since a lot of sockets cannot be generated by default.

Reboot the computer hosting the Load Generator after adding the following values to the \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters key using regedit.


MaxUserPort - 65534 -(REG_DWORD, decimal)
TcpTimedWaitDelay - 30 - (REG_DWORD, decimal)

How to add a cookie in Neoload | Web_add_Cookie in Neoload | How NeoLoad manage cookies?

NeoLoad automatically manages any cookies returned by the server during the load test. These cookies can also be defined when configuring the request settings. If you want to add a cookie manually then use the below code in JavaScript NeoLoad. That's it.

context.currentVU.setCookieForServer("Domain=www.easyloadrunner.blogspot.com","Environment=CityLS");

Wednesday 24 August 2022

Generate current date or Timestamp in NeoLoad using JavaScript | NeoLoad date variable | Get Date/Time in UTC in JavaScript

If you want to generate current Timestamp in NeoLoad using JavaScript, you can simply write the below code and you can enhance more based on the result. you can add days or months or years.

//Declare the variables

var DateNTime = new Date();
var utcDate = DateNTime.toUTCString();
 
//Print results to NeoLoad log

logger.debug("UTC_Date="+utcDate);

// Inject the computed value in a runtime variable, this can be used as a parameter in the NeoLoad requests ex:${UTC_Date}

context.variableManager.setValue("UTC_Date",utcDate);

Tuesday 23 August 2022

Get epoch timestamp in Neoload | epcoh time stamp java script with neoload

if you want to generate the epoch timestamp in Neoload, its so simple you just need to write 4 lines of java script and can pass the same variable to your requests.


var time = new Date()
var Timestamp = Math.round(time.getTime() / 1000)

logger.debug("time="+Timestamp);
context.variableManager.setValue("time",Timestamp);






How to delete unwanted files and results folders from LoadRunner scripts folders

When you are running load runner script for multiple iterations, it may pileup the logs and idx files in the script folder, which causes the more memory consumption for script folders. To get rid of this, we can execute a simple batch file . Copy all the below code and paste it in a notepad and name it as LRCleanUP.bat batch file. Then go to LR scripts folder and double click on it.

This batch file can be run either from within a script folder, or from a top-level folder containing multiple LoadRunner scripts. If run in a top level folder it loops through all sub-folders deleting files and results folders as it goes. It deletes unwanted log files and output files

IF EXIST %temp%blankfile.txt  del %temp%blankfile.txt /q
IF EXIST %temp%FilesDeleted.txt  del %temp%FilesDeleted.txt /q
IF EXIST %temp%FoldersDeleted.txt  del %temp%FoldersDeleted.txt /q
IF EXIST %temp%BadParms.txt  del %temp%BadParms.txt /qtype nul > %temp%blankfile.txt
type nul > %temp%FilesDeleted.txt
type nul > %temp%FoldersDeleted.txt
type nul > %temp%BadParms.txt
del *.idx /s >> %temp%FilesDeleted.txt
del mdrv*.log /s >> %temp%FilesDeleted.txt
del mdrv.txt /s >> %temp%FilesDeleted.txt
del options.txt /s >> %temp%FilesDeleted.txt
del *.ci /s >> %temp%FilesDeleted.txt
del combined_*.c /s >> %temp%FilesDeleted.txt
del output.txt /s >> %temp%FilesDeleted.txt
del debug.inf /s >> %temp%FilesDeleted.txt
del *.bak /s >> %temp%FilesDeleted.txt
for %%d in (h) do (
for /f “delims=” %%a in (‘dir/s/b/ad “%CD%result*”‘) do (
echo “deleted %%a” >> %temp%FoldersDeleted.txt
rd /s /q “%%a”
)
)
rd result1 /s /q
findstr /S “:\” *.prm > %temp%BadParms.txt
fc %temp%FilesDeleted.txt %temp%blankfile.txt > nul
if errorlevel 1 “Notepad.exe” “%temp%FilesDeleted.txt”
fc %temp%FoldersDeleted.txt %temp%blankfile.txt > nul
if errorlevel 1 “Notepad.exe” “%temp%FoldersDeleted.txt”
fc %temp%BadParameters.txt %temp%blankfile.txt > nul
if errorlevel 1 “Notepad.exe” “%temp%BadParms.txt”
IF EXIST %temp%blankfile.txt  del %temp%blankfile.txt /q
IF EXIST %temp%FilesDeleted.txt  del %temp%FilesDeleted.txt /q
IF EXIST %temp%BadParms.txt  del %temp%BadParms.txt /q

Monday 15 August 2022

How to Record Desktop Applications Using Jmeter | Desktop application load test with Jmeter

Recently I got a requirement of load testing for a desktop stock market application. The desktop application recording is quite simple just you need some proxy settings. The proxy settings for desktop application is to set the proxy at system level in-spite of browser level. The recording is same as browser recording with JMeter. Following is the process for recording the Desktop application using Proxy. You need latest version of JMeter for this recording. Old versions were not supporting.
  • Open "Internet Options" from Control Panel.
  • Click on "Connections" Tab and Click on "LAN settings"
  • Go to Proxy Server tick the "Use proxy for your LAN"
  • Edit the localhost as address and 9091/9092 as port (Do not use 8080/8888 ports) then click OK
  • Disable or uncheck the Automatically detect settings




JMeter Proxy Settings:
  • Use this same Proxy setting in JMeter proxy Server and please keep in mind that do not open any other application that use the same network .
  • Start Proxy in JMeter and Open the desktop Application, and now record it. That's it

Happy Testing !!

Capture the count of parameters in a file Neoload | Loop the parameter count times in Neoload | Neoload java script container

If you want to capture the count of parameters in a parameter file and loop the number of parameter times in  NeoLoad just use the java script code as below and get it done.

//Declare a variable in a file.Adjust the path to your file variable as necessary.

var fileName = "C:\\Users\\NeoloadScripts\\Desktop\\Userid.txt";

Note: you can use any file here either txt or csv or any other text formats

//Read the File and get line count


var reader = new Packages.java.io.LineNumberReader(new Packages.java.io.FileReader(fileName));
while ((reader.readLine()) != null) {}
var lineCount = reader.getLineNumber();
reader.close();



If a file variable has a column header line, alter the value by deducting 1 from the value; otherwise, don't use.

var lineCount = lineCount-1

//Log value of line count from file

logger.debug("Line number is = "+lineCount);


//Return to the Neoload script a variable with the value of the line count.


context.variableManager.setValue("LoopCount",lineCount);


After this java script go to the go to the loop and in the settings-execute loop enter ${LoopCount} as shown in below.



Tuesday 9 August 2022

Load runner to Neoload script converter with a command line tool | LR to Neoload Script Converter

A command-line utility called The Script Converter transforms LoadRunner scripts into NeoLoad projects.

Download the tool from here {Neotys Lab}:

Download Script Converter

Open Command Prompt and enter the following Command:

-source <LR Scripts folder> -target <NeoLoad output directory> -project <NeoLoad Project name

Example: 

Windows.\script-converter.bat -source "C:\LoadRunnerScripts\TestHome" -target "C:\Users\Documents\NeoLoadProjects\TestHome" -project "TestHome"

Linux/OSX./script-converter.sh -source "/home/user/LoadRunnerScripts/TestHome" -target "/home/user/NeoLoadProjects/TestHome" -project "TestHome"

LR Scripts folder - Source directory where all scripts in each sub-directory will be converted into the output Project
NeoLoad output directory - The folder of the created NeoLoad Project
NeoLoad Project name - The name to assign to the NeoLoad project

Saturday 6 August 2022

How to convert LoadRunner script to NeoLoad project? | NeoLoad Script Converter

I have a Loadrunner script and I would like to convert it to a Neoload Project. There's an easy way to do this automatically.
1.First you need to open Neoload tool, then go to Tools and Script Converter 

2. You need to enter load runner script directory or folder(not the Vugen Script location) and give a name to your neoload project and give the directory path where the neoload converted script need to be stored as shown in below.


3.Click on next to initiate the conversion process

Once the the process is over, It will show you the successful message as highlighted in the below image.

You can see the converted neoload project loading

This is the final converted script with all Init, Action and end.

Note: (This converter utility is available in 6.2 or below version only. You can install both neoload 6.2 and 8 versions on the same machine if you need converter utility,but at a time you can open any single version as both of them using same port 8090)

Friday 29 July 2022

One or more files in the script's folder is in use,preventing script replay,Close the files and try to replay the script again.Vugen Error



1) Please check that Explorer not open on replay script folder ( probably result1 )

2) please check that any files from result1 folder is not opened on external editor / browser

3) please check on Task Manager that there isn't any process of HP.Utt.StandaloneDebugger.exeY

4).You can run the command line utility 'handle.exe' to show all opened files per process. Save the output and check for your LR script directory.

5).Run procmon.exe and define the filters such that you monitor the load runner processes or the script folder. Start your test and check which open of existing file is failing.

Load runner Analysis Granularity issue - Reduce for all Graphs is not working

If you wish to use a greater level of granularity for a large number of graphs, use the following settings:
1. Open the "Tools > Options > Result Collection" tab before loading the result (before starting a new session).
2. Choose "Data Aggregation > Apply user-defined aggregation" from the drop-down menu.
3. Select "Aggregation Configuration" from the drop-down menu. There, in the field "Select the granularity you wish to utilise," type the number you require.After that, you can use the option to reduce the granularity of several graphs.

Error -35196: HTTP Status-Code=422 (Unprocessable Entity) for "https://easyloadrunner.blogspot.in", Snapshot Info [MSH 2 5] [MsgId: MERR-35196] VUGEN Load runner error

The 422 Unprocessable Entityerror code is a response that indicates the request was well-formed but was unable to be followed due to semantic errors. The most common cause of the 422 Unprocessable Entityerror code is poorly written or corrupt database tables– these need to be repaired or deleted and recreated.
This 422 error can also happen because a script is trying to run, but the server does not have permission for that particular file. This could mean you need new permissions on your web hosting account, or it's caused by an improperly set up PHP configuration in your site's root folder.
The422 Unprocessable Entitystatus code is a client-side error. It belongs to the HTTP response status codes in the 4xx category, called client error responses.

If you're not getting any messages about the problem, your web host might not allow access to these logs. If this is indeed the case, we recommend switching providers as soon as possible because this 422 error could indicate a bigger issue with your site, such as malware or something else security-related.

If you can access your logs, then the next step is to look for exceptions. These errors can be caused by a script that's trying to run but cannot because of improper permissions on the webserver or improperly set up PHP configuration in your site's root folder. If this isn't working, it could also be an issue with the script itself, which can be solved by contacting a developer.

Another way of fixing the 422 Unprocessable Entityerror code is to upload a fresh version of the script to your server. Some people can do this through FTP, while others may need assistance from their hosting provider.

Saturday 5 March 2022

Read or Write a Notepad with load runner or Read Write text file in load runner Vugen

If we want to alter a text file(.txt) with loadrunner or we may need to read or write the notepad,we can simply use load runner inbuild functionalities.Here is the example.

Script code:

 char * filename =”C:\\easytech\\loadrunner\\testfile.txt”; 
// {Use // quote instead of single (/) for defining path.}
long file;
char names[100];

Vugen Action:
Action()
{
fopen(filename, “r”);
if ((file = fopen(filename, “r”)) == NULL) {
lr_error_message (“Loadrunner cannot open the %s”, file);
return -1; }

while (!feof(file))
{
fgets(names, 200, file);  // here 200 decide the length of the contents in a line. So, if you have longer piece to read, you'll need to lengthen it.

if (!feof(file)) //if not at the end of file print names
{
lr_output_message(“%s”,lr_eval_string(names));
}
}
fclose(file);
return 0;

Hope this helps,Comment if you are facing any issues.

Wednesday 9 February 2022

ctrx_type and ctrx_key functions in Citrix Protocol in Load runner

Syntax:

ctrx_type (string) 

ctrx_key (key, key modifier) 

These functions are the way to send keyboard data to the Citrix server. 
ctrx_type function: Sends normal keyboard data
ctrx_key function :Sends non-alphanumeric keys to the server.
 To send special keyboard commands like Alt-F, ctrx_key can be used.
Example: ctrx_key (“f”, MODIF_ALT) will send Alt-F to the server.

Wednesday 26 January 2022

java.util.prefs.WindowsPreferences WARNING: Could not open/create prefs root node Software\JavaSoft\Prefsat root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

This error is because java.util.prefs.WindowsPreferences is trying to save information in HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs instead of under HKEY_CURRENT_USER\Software\JavaSoft\Prefs.

Open JMeter.bat file as the administrator and so it creates the key HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs. Hope this resolves the issue.

Wednesday 5 January 2022

How to correlate Cookies in LoadRunner? or Vugen?

An HTTP cookie (also known as a web cookie or browser cookie) is a small piece of data sent by a server to a web browser. The cookie may be saved by the browser and sent back to the same server with subsequent requests. An HTTP cookie is typically used to determine if two requests originate from the same browser, such as to keep a person logged in. For the stateless HTTP protocol, it remembers stateful information.

It's crucial to think about whether you need to correlate cookies or not when recording/scripting. Simply keep track of your business actions and observe if any web_add_cookie() calls were made to the website. If there are any calls, you must correlate it.

Cookies are of 2 types.
Client send cookies and 
Server send cookies.
If you need to correlate server side cookies,then you Identify the request for which the server sends the desired cookies.Then correlate the cookie.
--> If the value appears in header,use web_reg_save_param(""); In attributes use "Search=Headers".
-->> If the value appears in Cookies,use
web_reg_save_param_ex(“ParamName=Cookie”,“LB=Airshixtf245”,“RB=*!@>”,“Ordinal=1”,SEARCH_FILTERS,“Scope=COOKIES”,LAST);

If the cookie to be correlated is a Client side cookie generated by Java code then you need to understand the logic behind the cookie generation.Then try to write a C program that generate a similar cookie.