Skip to main content

Lr Convert String Encoding Function Usage in Loadrunner with Examples

lr_convert_string_encoding=convert a string to a different encoding.

By using this Loadrunner function we can convert string to following formats

Unicode
UTF8
System Locale

The function saves the result string, including its terminating NULL, in the parameter name. Printable characters in the Output result string are displayed in VuGen and its logs as the actual characters. Non-printable characters are displayed in Hexadecimal.

For example:

rc = lr_convert_string_encoding("A", NULL, LR_ENC_UTF8, "stringInUnicode");
The output in the vugen string displays as A\x00, and not \x41\x00, because A is a printable character.
Add lr_convert_string_encoding is not recorded during recording. We need to insert manually when needed.

Script in Vugen:

Action()
{
int rc = 0;

//Convert String to Unicode in Loadrunner
rc = lr_convert_string_encoding("Hello world",
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UNICODE,
"stringInUnicode");

// Convert String to UTF8 in loadrunner
rc = lr_convert_string_encoding("Hello world",
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"stringInUTF8code");
return 0;
}

Note: To get the output please enable parameter substitution in runtime settings->Log->Extended Log->Parameter Substitution.

Output:

Starting iteration 1.
Maximum number of concurrent connections per server: 2         [MsgId: MMSG-26000]
Starting action Action.
Action.c(7): Notify: Saving Parameter "stringInUnicode = H\x00e\x00l\x00l\x00o\x00 \x00w\x00o\x00r\x00l\x00d\x00\x00\x00".
Action.c(17): Notify: Saving Parameter "stringInUTF8code = Hello world\x00".
Ending action Action.
Ending iteration 1.

Comments

Popular posts from this blog

NeoLoad Interview Questions and Answers

Here are some of the interview questions and answers on NeoLoad:
What is NeoLoad?
NeoLoad is a performance testing tool designed to test different types of web, standalone and mobile applications.
What is the difference between Loadrunner, JMeter and NeoLoad?
Click here for differences
What are the different counters you monitor in NeoLoad?
Average Response Time(requests), average response time(pages), average requests/s, average throughput, current response time(requests), current response time(pages), current requests, current throughput, current users count, controller cpu load, controller memory load etc.
What are the different type of tools you can integrate with NeoLoad?
App Dynamics, CA APM Integration, Dyna trace integration, HP ALM or Quality Center Integration, Java and Jamo Solutions M-eux Test Integration, Jenkins Integration, perfecto mobile integration, selenium integration.
What are the different type of Operating systems you can monitor?
Linux Monitor, Solaris Monitor, AIX …

File operations in loadrunner with examples

In this post I will explain how to capture a value from server response and save to a text file using vugen.
How to capture and save to text file using loadrunner:
First I have recorded the script using bing.com and then i searched for IBM. We will get 10 results. I have captured all the 10 values and saved to a file.
Here is the code for that.

Sitescope Monitoring Tool Features and Monitors

Why Sitescope is called Agentless Monitoring Tool?
HP SiteScope monitors the application/infrastructure/server/operating system without installing any agent software on the system to be monitored. This feature makes the installation, usage and maintenance of Sitescope simpler when compared with the any performance monitoring tools like Diagnostics.
Sitescope Monitors:
Sitescope has also upgraded and changed drastically to meet the rapidly changing technologies and environments like virtualization and cloud computing. Using Sitescope we can monitor different web servers, application servers and database servers. We can also monitor operating systems Windows, Linux, Sun Solaris, IBM AIX. It has more than 100 monitors including Weblogic, Websphere, SAP, SIEBEL, SNMP, LDAP, Network Monitor etc. HP SiteScope can also monitor cpu utilization, response time, disk space, and resource availability of a variety of host types and application platforms.
Sitescope Features:
SiteScope provides failover …