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

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."

 

Comments
zy | ‎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.... 

| ‎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.

kiranbadi1991 | ‎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.

 

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22422227.html

 

 

ASliwx | ‎03-23-2011 09:01 AM

Eyal,

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.

 

cheers/drew

 

 

Leave a Comment

We encourage you to share your comments on this post. Comments are moderated and will be reviewed
and posted as promptly as possible during regular business hours

To ensure your comment is published, be sure to follow the Community Guidelines.

Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.
Search
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 trans...


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation