Introducing Java recording in LoadRunner!
Posted: April 21st, 2008 | Author: TnT Admin | Filed under: Concepts | Tags: Java, LoadRunner, Scripting | 1 Comment »LoadRunner provides the capability of load testing Java-related applications. If you are new and unfamiliar with how LoadRunner works and the relations with protocols, I would recommend to review “What’s LoadRunner?” and “Which protocol to use?” to have an understanding before proceeding. In this article, we will provide a brief introduction to working with Java-related applications in LoadRunner that you will have to take note.
1. Introduction
Before we start choosing Java-related protocols to perform recording, you will need to understand the protocol that the Java application is using to communicate with the server. It maybe the case where the Java application is communicating via HTTP rather than RMI-Java, etc… If you have identified that the application is communicating with a Java related protocol, you can safely proceed to choose the relevant Java protocol.
For Java-related protocol, the recording works in the same way as .NET and COM/DCOM protocol. All of them share the same characteristics but I will specify to just Java and only Java recording. Pure Java scripting will be excluded in this article.
Unlike .NET and COM/DCOM, Vugen provides an interface to manage and filter the classes and methods via the GUI which is very convenient to the user. Hopefully, Mercury/HP may consider that in future.
2. Classes and Methods
You will need the knowledge of the classes and methods prior recording; and usually this information is held by the developers. The need to know the classes and methods is crucial because, LoadRunner (Vugen) implements a hooking mechanism to hook the traffic on the classes.
If you do not know what classes are needed for the load test, and allow LoadRunner to capture all traffic on the classes, you may result in excessive capturing such as GUI clicks or client activities. On the other hand, if you did not specify the actual classes involve in the load test, you may miss out on the real class being used.
The above mention is based on the default Java hooking mechanism that LoadRunner implements. But if you required to have additional classess you need to record, you will need to configure the hooking mechanism that will be covered in subsequent post. This is also the reason the knowledge of the classes and methods come in important.
3. JDK and JRE
Other than the knowledge of the classess and method, you will need to know the JDK of the application. By default, Sun Microsystems JDK (SDK) works with LoadRunner.
There will be scenarios that your application is not using te Sun JDK such as IBM JDK. If that is the case, my advise is to check with Mercury/HP on the compatibility level and this will save you lots of effort. In my experience, usually they are not as fully supported as compared to Sun JDK.
The minimum supported JDK is JDK 1.3 for LoadRunner 8.1 as of this writing. Take note that the recording is still very dependant on the JDK version installed. That is, if your application is JDK 1.6, you will have to install this version on the recording machine.
Lastly, JRE is insufficient for the recording to be successful. Ensure that JDK is installed.
4. Recording-specified
LoadRunner Vugen implements an API that hooks into the selected classes and record the traffic. Therefore, as pointed earlier, knowing the correct classes to hook is crucial.
With the hooking in place, GUI classes or client-side activities maybe recorded via the hook. However, this is not recommended as it does not contribute to the load generation towards the server. I will share with you the recording details in another article. Do stay tuned for it.
5. Scenario Execution
Prior the scenario execution in the Controller, ensure that JDK have be installed on the Load Generators. The scripts sent (refer to the article,“4 points to note for Scenario Execution” for more information) are Java scripts, and require JVM to run.
6.Documentations
If you like to know more information from the official provider, you can refer to the Vugen User Guide that is provided in each installation of LoadRunner in PDF format. Specifically the following chapters:
- 1. All chapters in Part II: Working with Java Language Protocols
2. Chapter 18: Developing Corba-Java Vuser Script
3. Chapter 19: Developing RMI-Java Vuser Scripts.
7. Samples
Also, if you like to get a feel of working with Java protocol, I would recommend using the sample example provided with every installation of LoadRunner. It will at least get you understand what will happened and the expected output when recording Java language applications.
That comes to the end of the introduction of the workings of Java language protocol in LoadRunner, things to watch out and additional resources to pertaining to the topic. Do take note that Java is not as straight-forward as Web(HTTP/HTML) and therefore give it additional attention when working on such load testing projects.
Hi, Does anyone have the login details for the java demo that comes loadrunner.
The app is called StockMarket.
Thank you in advance