Home

Awesome

JMeter-RTE-plugin

labs-logo

This project implements a JMeter plugin to support RTE (Remote Terminal Emulation) protocols by providing a recorder for automatic test plan creation, and config and sampler for protocol interactions.

Nowadays the plugin supports IBM protocol's TN5250, TN3270 and VT420 by using embedded xtn5250, dm3270 and jvt220 emulators, with some modifications on xtn5250 fork, dm3270 fork and jvt220 fork to better accommodate to the plugin usage (exception handling, logging, external dependencies, etc).

People who usually work with these IBM servers interact with them, basically, by sending keystrokes from the terminal keyboard (or emulator) to fill forms or call processes. The plugin provides a recording controller, which allows the user to interact through a terminal emulator, recording every interaction (samplers) with the mainframe application. Additionally, the plugin allows for manual test plan creation, providing a config element for setting connection parameters and a sampler to set fields on screen and attention key to send to the mainframe application. Besides, the sampler allows to simulate the existing attention keys on the terminal keyboard like ENTER, F1, F2, F3..., ATTN, CLEAR, etc.

Usage

Using the plugin

The plugin adds four different elements to JMeter:

A Recording Controller (RTE-Recorder)

alt text

Configuring the RTE Recorder

First all is necessary to add a template which is going to contain all the elements required to begin with recording. Go to Files -> Templates -> and select Recording RTE

alt_text

Usage of RTE Recorder

To start recording, the user should specify the Server, Port, Protocol, Terminal Type, SSL Type, Timeout and Timeout Threshold. These configurations are the same ones detailed in RTE-Config. Details about Timeout Threshold field and how the wait conditions works can be found here. alt_text

RTE recorder buttons purpose:

Once everything is configured, the user proceeds to start the recording session, pressing START button. After the connection to the mainframe application is established (supposing configurations are right), the Terminal Emulator will show up.

alt_text

Click here to see all the information you must know about terminal emulator.

Now we are able to interact with our client through RTE-Emulator. Every interaction will be automatically saved in samplers (check out everything about samplers ). Once we have ended the flow that we want to record, we can easily close the terminal emulator or press STOP button to stop our recording.

alt_text

Child View Results Tree integration:

When a View Results Tree JMeter test element is included as a child of the RTE recorder, then all interactions between the Terminal Emulator and the mainframe application will be showed on the View Results Tree and allow for proper analysis and validation of all information sent and received from the mainframe application.

alter_text

A Config Element (RTE Config)

alt text

The RTE Config element sets the parameters to be used by the sampler in order to establish a connection to the server. These parameters are:

If more than one RTE Config element is used at the same level of the Test Plan, JMeter will take the value of the first one. On the other hand, if there are more than one RTE Config used but in different levels, JMeter will use the "closest" (according to test plan tree levels) Config element for each sampler.

Sampler (RTE Sampler)

alt text

Connections are shared by RTE Samplers in same thread created by a thread group (different threads use separate connections). The RTE Sampler element checks if a connection exists to send the packets, if none exists, it uses the RTE Config data to establish a new one. Connections are automatically closed (unless Jmeter property RTEConnectionConfig.reuseConnections=true is specified in jmeter.properties) at the end of each thread iteration.

This means that it's always required an RTE Config Element in order to connect the RTE samplers to a server.

The RTE Sampler fields are:

Stable Period

All the "waiters" use a stable timeout value (in milliseconds) which specifies the time to wait for the emulator to remain at the desired state. The default value is 1000 milliseconds, but can be changed by adding the property RTEConnectionConfig.stableTimeoutMillis=<time_in_millis> in jmeter.properties file. The "Wait for silent" waiter is not affected by this setting since it has an explicit field for such purpose.

Warning: both Stable Timeout and Silent Interval should be shorter than Timeout value, otherwise the sampler will always return a timeout error.

Character timeout

With the addition of the VT420 protocol, now we also support its "character at time" behavior, which means that, every time we type a key, we have to wait for a response of the server to send the next one. Therefore a character timeout comes to play. This period of time is the maximum amount in milliseconds to wait for a server response when sending a character.

Notice: If the time elapses, the user will experiment with a TimeoutException.

The default value of this timeout is 60000 milliseconds, but can be changed by adding the property RTEConnectionConfig.characterTimeoutMillis=<time_in_millis> in jmeter.properties file.

RTE-Position Extractor

alt_text

RTE-Position Extractor is a post-processor which its main purpose is to extract positions from response headers to be used later as a JMeter variable.

Check here for more information.

Example

Suppose the user wants to automate the following workflow with an AS400 server (TN5250 system):

  1. Connect to the system myAS400.net and validate that the screens shows the "Welcome" message.
  2. Fill the user field (which is in row 7 and column 53 of the screen) and the password field (which is identified by the label 'Password' of the screen) and press Enter key. Validate that the screen shows the message "Login Successful".

To do this, first of all it's required an RTE Config element specifying the server url and the protocol (TN5250). Additionally, two RTE sampler's are required: one to establish the connection and validate the Welcome screen, and the other to do the login.

The test plan would look like this:

alt text

The RTE Config element should specify the server url in Server field, and the protocol TN5250 in Protocol field like it's shown below:

alt text

"Connect" action should be selected in first sampler to just connect and get the welcome screen after the connection. An assertion post processor should be attached to it to validate the "Welcome" message.

alt text

Finally, the second sampler should use "Send keys" action (the default option) and specify in Payload grid the position of the username on the screen, the label (in this case 'Password') and the values for both user and password fields. Besides, the attention key ENTER (the default one) should be selected to simulate the user pressing that key after filling the fields. Finally, an assert post processor should be added to check for the "Login Successful" message.

alt text

Waiters usage

As explained previously, the RTE Sampler has 4 types of waiters which work as synchronization functions, in order to ensure that the response shown by the sampler is the screen that the server wants to show. It's recommended to always have at least one waiter checked on each sampler.

Tips

How to extract a label from the screen.

The RTE plugin does not have a functionality for itself to achieve this goal. Therefore, Regular Expression Extractor will be our solution.

Example of usage:

alter_text

We have obtained the screen above from a sampler response. Suppose we want to extract the date which appears close to the right top corner "123456".

In order to capture the date value we have to add a Regular Expression Extractor embedded in bzm-RTE-SEND_INPUT-1 sampler.

A proper configuration in that case would be something like this: alter_text

If you want to understand how Regular Expression Extractor works, visit this JMeter page.

How to extract a value on the screen from a given position.

In order to get a value, we have to know the beginning of the value in coordinates and the length of the text to match.

alter_text

For instance, suppose that we need to extract the date using positions. We already know the size of the screen, which is 24x80 (in this case).

Using the emulator we have identify the beginning coordinates of the date value (1,67). Also we know that the length of the text would be six characters.

With all this information we have develop a regex to match that criteria:

^(.+\n){0}.{67}((.){6})(.*\n){23}(.*)$

Once we got the regex, our Regular Expression Extractor would be like this:

alter_text

If you want to understand how Regular Expression Extractor works, visit this JMeter page.

Compatibility

The plugin is tested with Jmeter 3.1, 3.2, 3.3, 4.0 in Java 8 and 11. Code base is implemented in Java 1.8, so lower versions of JVM are not supported.

Contributing

If you find any issue or something that is not supported by this plugin, please report it and we will try to fix it. It will help a lot if you send us the JMeter logs with debug log level enabled.

Debug log level could be enabled by configuring the Log4j 2 Configuration File (adding <Logger name="com.blazemeter.jmeter.rte" level="debug" />) or via JMeter menu, how to do it from both ways are explained here.

Otherwise you could contribute to the project.