LoadRunner and Performance Center
Showing results for 
Search instead for 
Do you mean 

Eyal Nadler asks: "LoadRunner C-based scripts – an end of an era?"

mtomlins ‎10-01-2010 06:14 PM - edited ‎09-25-2015 03:20 PM

From Eyal Nadler, Senior Software Engineer in LoadRunner R&D:


"To be honest, I thought carefully before raising this question. The last thing I would like to trigger is yet another debate in the form of VI vs. Emacs, Windows vs. Linux, and Java vs. dotNET. This kind of a debate tends to be very emotional, not to say religious. 


I will do my best to stay on the practical road.


First and most - C is my favorite programming language. Yes, I’ve said it. All of you Java/ C# guys – ignorance is blessing in many aspects of our lives,  but not when it comes to programming J I’m being religious now, so I will stop here.


I’ve been in LoadRunner from its early days. Back then, C actually was the only option. It was quite simple, fast, with a large user base, code base, tools, and ecosystem. It was THE language. Our code was actually written in C (and later in C++) so it was only naturally for us to select it as our scripting language.


Days have passed. Many languages came out and gained popularity.  We now have dynamic languages, functional languages, native compiled language, VM based languages, strongly typed, weakly typed - we have them all, lots of them. Doing things became much easier. Low level detailed programming lost its place in favor of abstraction and ease of use.  People started to appreciate less typing effort, string manipulation, regular expression, garbage collection, type inference and other convenient features. Many tools were developed - syntax highlighters, bug detectors, static analyzers and smart debuggers – that made a programmer’s life much easier.


What does it mean for us, LoadRunner developers and users?


Before I will try to answer this question I would like to make a difference between two related concepts. The first is “LoadRunner script” and the second is “replay library”.


LoadRunner script is a description of a business logic process.  It is an output of a business process recording. It is built from steps that together assemble the business logic. 


A step is basically a function that does some action. There can be helper/utility functions, but the most important ones are the replay library functions. These kinds of functions/steps are the core functionality of LoadRunner.  This is the place in which the real work takes place. Each protocol has its own steps in which it implements the protocol internal logic, keeps the protocol state, parses it’s input/output and sends/receives data over the network.  


Since load is our business we want to produce as much network traffic as we can. We need our replay library steps to be fast, scalable and with low-memory footprint. C is the best language for such demands.


However, the script itself is only a container to manage the flow. A user can manipulate the recorded script by adding helper functions, add/remove steps etc.   This way of manipulating the script has nothing to do with the capabilities that C has to offer. Some may even say you don’t need a script in order to manipulate the steps, just to model it (This approach is even being emphasized more with the asynchronous nature of the “Web 2.0”. Model instead of a script is beyond the scope of this post, I may tackle it in one of my next posts). 


The question I would like to raise is why the script should be in C? What do we gain from this fact?


Please remember, a LoadRunner C script is not compiled to a native machine language. Instead it is compiled to a virtual machine byte code that is being executed by an efficient virtual machine. C as a language loses its power when translated to a byte code.  One is only left with the C syntax and book keeping but without its real power.


Can we use a more suitable language for managing the steps and drive our business logic?


I would vote for a “Yes”.  As I’ve said earlier, there are languages now that make things simpler. They can run on top of a proven virtual machine (JVM, .NET for example). They have mass user base, supporting libraries, existing editors, advance debug capabilities, simple syntax, great string manipulation, etc.


I’m not going to suggest a single language here because it deserves its own post. However, I will say that .NET/JVM languages are good candidates for that.


I will be happy to hear/read your thoughts regarding this issue.


Sincerely, Eyal."


0 Kudos
About the Author


Mark Tomlinson is a software tester and test engineer. His career began in 1992 with a comprehensive two-year test for a life-critical transportation system, a project which captured his natural aptitude for software testing, quality assurance, and test automation. That first test project sought to prevent trains from running into each other -- and Mark has metaphorically been preventing “train wrecks” for his customers for the past 20 years. He has broad experience with real-world scenario testing of large and complex systems and is regarded as a leading expert in software testing automation with a specific emphasis on performance. For the majority of Mark’s career he has worked for companies in a strategic role and used the leading products for performance testing, profiling and measurement. He has also consistently established close ties and relationships with the majory vendors who create these tools. While working as the Technology Alliance Manager at Mercury interactive in 2001, Mark was responsible for developing innovative integrations with cutting-edge partner technologies such as Microsoft .NET, SQL Server and Windows Server, IBM Webshpere, RealNetworks, Adobe Flash, and Citrix. Mark worked for 6 years at Microsoft Corporation as a performance consultant and engineer in the Microsoft Services Labs, in the Enterprise Engineering Center, and in the SQL Server labs. His efforts to foster the success of Microsoft’s top-tier Enterprise customers was focused on their early adoption of Microsoft products as part of mission-critical operations. In 2008, as the LoadRunner Product Manager at Hewlett Packard, Mark led his team in delivering leading innovations for performance testing and engineering.

on ‎10-07-2010 10:50 PM

The advantage of C is not only its efficiency, but also its global/stable standard. Considering .net/java, both of them are business products, MS/Oracle are keeping updating the frameworks very frequently, together with a buntch  of libraries, virtual concepts, wrappers, etc.... 

on ‎01-03-2011 08:38 AM

Great post. As an aside, considering that the C code is translated and run on an interpreter, I'm amazed at how rarely I see errors from that part of the system.

on ‎01-21-2011 03:52 AM

Great Post  and some of my thought below.


I think C language used by LR needs to enhanced.I would say choose any language helps to replicate browser behaviour more accurately.Some might require that LR inherit some browser behind the scene functionality and some might require language enhancement by providing more functions.


Please see this post's question, its quite a challenge to work with this for large platform tests with existing LR setup.Problem statement looks extremely simple but problem area is mostly unknown  and solution is bit lengthy and broken.





on ‎03-23-2011 09:01 AM


Great article. I really like :

 - LoadRunner.Vuser.Script is a description of a business logic process. 
 - It is an output of a business process recording.
 - It is built from steps that together assemble the business logic.


Being a hard-core Loadrunner user since 2000 and working for Merc back in the day.

I believe the Loadrunner and QTP and BProcessing testing have created unified language (BP-UML) if you'd like way allows users to communicate their requirements and also the automation engineer to validate that requirements are being implemented within the script.


Where Loadrunner braches off into more then 1 user testing is its capability of Created Scenarios/Workloads that mimic real world operational environments.


With above - loadrunner vuser script is a very powerful and flexible 1 user for 1..N iterations.





on ‎02-16-2012 03:41 AM


I wrote some code in C, which is for moving a file from one to another folder.

I included the .h file in loadrunner include folder, and also included in loadrunner script like this-

#include 'MoveFile.h'

Action() {

//here is done some action


Also I want to show the code in MoveFile.h 


void main(int arg,char *arr[])
FILE *fs,*ft;
char ch;
printf("Argument Missing ! Press key to exit.");

fs = fopen(arr[1],"r");
printf("Cannot open source file ! Press key to exit.");

ft = fopen(arr[2],"w");
printf("Cannot copy file ! Press key to exit.");

ch = getc(fs);

printf("File copied succesfully!");


I am sorry for this long quetsion and post, but i have got a problem with compiling, cause loadrunner couldn't find the libraries. 

Finally, my question is, how to check out where and how can i add libs needed?

What compiler does loadrunner use ?

Is there any compiler, that i had to install before installing loadrunner ?

27 Feb - 2 March 2017
Barcelona | Fira Gran Via
Mobile World Congress 2017
Hewlett Packard Enterprise at Mobile World Congress 2017, Barcelona | Fira Gran Via Location: Hall 3, Booth 3E11
Read more
Each Month in 2017
Software Expert Days - 2017
Join us online to talk directly with our Software experts during online Expert Days. Find information here about past, current, and upcoming Expert Da...
Read more
View all