Java Serialization: Handle external libraries

This tutorial describes how to design a Virtual User containing Java Serialization requests. It introduces you to the Post-Recording Wizard, which is used to instruct NeoLoad how to decode the Java Serialization requests. If you do not have all the required files during the recording, this tutorial explains how to repair Java Serialization requests that could not be decoded.

To gain the most from this tutorial, it is recommended to have read the following sections beforehand:

Understand the context

In the same way that it allows HTTP requests to be defined and tested, NeoLoad also provides a method of load testing web applications programmed in Java using specific Frameworks such as Spring Remoting (Spring HTTP Invoker). Java Serialization requests are similar in many ways to standard HTTP requests. This means that all the NeoLoad features available for testing HTTP requests can also be used for Java Serialization, including the use of variables and assertions on the server responses.

Record Java Serialization requests

To record Java Serialization requests, see Record a test scenario.

Specific Frameworks such as Spring Remoting (Spring HTTP Invoker) make is possible to transport customized Java objects encapsulated in the HTTP protocol. If the Java object classes are missing, the request binary data cannot be decoded for conversion to XML. The following procedure explains how to solve the problem of missing Java classes.

Note: For Java Serialization, an object is said to be serializable when it implements the java.io.Serializable interface or the java.io.Externalizable interface.

Prerequisites

For NeoLoad to be able to decode the Java Serialization requests and responses, the following items are required: the JARs for the Framework used to transport the customized Java objects, the customized Java objects exchanged between the server and the client, and the other referenced classes.

Process

To record a Java Serialization request, follow these steps:

  1. When you close the browser, the Post-Recording Wizard is displayed.

  2. Select the JAR for the Framework used to transport the customized Java objects.

  3. Select the JAR files containing the missing serializable Java classes.

  4. Repeat the operation as many times as is necessary.

  5. When all the required JAR files have been declared, a confirmation screen is displayed.

For more information about the next steps in the wizard, see Post-recording wizard.

Fix a Java Serialization request after recording

The JAR files required by a Java Serialization request may be declared at any time.

Here, the request selected in the Virtual User requires Java classes that are not available. This fact is revealed by several indicators:

  • The request icon in the Virtual User.

  • The request contains unexpected characters, instead of XML.

  • A link (in blue) indicates that the Java Serialization libraries for this request are missing.

To fix a Java Serialization request after recording, follow these steps:

  1. Click on the link prompting you to declare the required Java Serialization libraries. You may also use Edit > Preferences > Project Settings > Libraries Manager > Java Serialization.

  2. Click on the + (plus) button to open the file explorer. Select the JAR file to declare.

  3. If the JAR file loads correctly, a dialog box confirms that the Java Serialization library has been successfully declared.

  4. The loaded JAR files appear in the list and a message informs you that the process was successfully completed. Once the request is correctly decoded into XML , it appears in XML format.

  5. If the request still has not been converted to XML format, it means that some required JAR files still have not been declared.

  6. Repeat the operation as many times as is necessary.