RTE Protocol Scripting in LR

Purpose

·         RTE Vusers operate terminal emulators in order to load test client/server systems.
·         You record a terminal emulator session with VuGen to represent a true user's actions. You can then enhance your recorded script with transaction and synchronization functions.
·         The RTE protocol works like when you are sending data to server it would send one character by character to DB.   so when you are increasing the Load the Database can take at one time one character for each user. so give more te wait time and increase the load gradually instead of simultaneous users.  If your are working on RTE means u are working on Mainframe or oracle forms application

Introduction

An RTE Vuser types character input into a terminal emulator, submits the data to a server, and then waits for the server to respond. For instance, suppose that you have a server that maintains customer information for a maintenance company. Every time a field service representative makes a repair, he accesses the server database by modem using a terminal emulator. The service representative accesses information about the customer and then records the details of the repair that he performs.
You use VuGen to create RTE Vuser scripts. The script generator records the actions of a human user in a terminal emulator. It records the keyboard input from the terminal window, generates the appropriate statements, and inserts them into the Vuser script. While you record, the script generator
Automatically inserts synchronization functions into the script.

An RTE Vuser emulates the actions of a real user. Human users use terminals or terminal emulators to operate application programs. 
 
In the RTE Vuser environment, a Vuser replaces the human. The Vuser operates PowerTerm, a Terminal emulator.

PowerTerm works like a standard terminal emulator, supporting common protocols such as IBM 3270 & 5250, VT100, VT220, and VT420-7.

Scripting Approach

Vugen can be used to record windows based Vuser scripts. VuGen uses the PowerTerm terminal emulator to emulate a wide variety of terminal types
This task includes the following:

 

Record the Terminal Setup and Connection

·         Open an existing RTE Vuser script, or create a new one.

 
·         In the Sections box, select the vuser_init section to insert the recorded statements.
·         In the Vuser script, place the cursor at the location where you want to begin recording.
·         Click the Start Record button. The PowerTerm main window opens.
·         From the PowerTerm menu bar, select Terminal > Setup to display the



·         Select the type of emulation from the VT Terminal and IBM Terminal types, and then click OK.
Note: Select an IBM terminal type to connect to an AS/400 machine or an IBM mainframe; select a VT terminal type to connect to a UNIX workstation.
·         Select Communication > Connect to display the Connect dialog box.
·         Under Session Type, select the type of communication to use.
·         For Terminal type 3270 Display, choose Terminal Type: 3270 Display, it will automatically set the default settings like session type, Terminal ID, and Port number according to your terminal type value, also you can change them according to your need.
·         Enter Host Name , which is given in Test Plan.
·         Click on Connect, it will connect to the server then follow the business flow given in test plan.



·         For VT terminals select the following options


·         Under Session Type, select the type of communication to use.
·         Under Parameters, specify the required options. The available parameters vary depending on the type of session that you select. For details on the parameters, click Help.
·         Click Connect. PowerTerm connects to the specified system, and VuGen inserts a TE_connect function into the script, at the insertion point.
·         The TE_connect statement has the following form:
·         The inserted TE_connect statement is followed by an if statement that checks whether or not the TE_connect function succeeds during replay.
·         Note: Do not record more than one connection to a server (TE_connect) in a Vuser script.
·         The terminal setup and connection procedure is complete. You are now ready to begin recording typical user actions into the Vuser script, as described below

Record typical user actions

After recording the setup procedure, you perform typical user actions or business processes. You record these processes into the Actions section of the Vuser script. Only the Actions section of a Vuser script is repeated when you run multiple iterations of the script. When recording a session, VuGen records the text strokes and not the text. Therefore, it is not recommended that you copy and paste commands into the PowerTerm window—instead, type them in directly.

  • Select the Actions section in the Section box.
  • Proceed to perform typical user actions in the terminal emulator.
VuGen generates the appropriate statements, and inserts them into the Vuser script while you type. If necessary, you can edit the recorded statements while you record the script.

When you record a script, the VuGen records all keyboard input and generates appropriate TE_type functions. During execution, TE_type  functions send formatted strings to the terminal emulator.

For example, the following function depicts the input of the Return key followed by the Control and y keys:

TE_type("<kReturn><kControl-y>");

Some other examples include: <kF1>, <kUp>, <kF10>, <kHelp>, <kTab>.

To determine a key name, record an operation on the key, and then check the recorded statement for its name.

Note: When navigating through application flow and have to input F13 or F14 function keys which are not available on your keyboard then use following key combinations
SHIFT+F1 for F13
SHIFT+F2 for F14
SHIFT+F3 for F15

Record the log-off procedure

  • Make sure that you have performed and recorded the typical user actions as described in the previous section.
  • In the VuGen main window, click vuser_end in the Section box.
  • Perform the log off procedure. VuGen records the procedure into the vuser_end section of the script.
  • Click Stop Recording on the Recording toolbar. The main VuGen window displays all the recorded statements.
  • Click Save to save the recorded session. After recording a script, you can manually edit it in VuGen’s main window.

Recording Options

You can set the recording options to match the character set used during terminal emulation. The default character set is ANSI. For Kanji and other multi-byte platforms, you can specify DBCS (Double-byte Character Set).
By setting the recording options, you can customize the code that VuGen generates for RTE functions. You use the Recording Options dialog box to set the recording options

 

RTE Functions and Enhancing Vuser script

Following main functions can be used to enhance script.
1.       TE_Connect : Connects the terminal emulator to the specified host. (Windows only)
Note 1: The TE_connect function must always be recorded into a script. Do not type or paste the function into a script. When you record a connection, PowerTerm creates various files in the script directory. These files contain various settings that describe the connection.
Note 2: Do not include more than one TE_connect statement in a script. The second TE_connect statement will fail with an "already connected" error.
Note 3: The TE_connect function must always be the first function in the vuser_init section of the script
2.       TE_find_text : Searches for text in the designated area of the terminal emulator screen
3.       TE_get_line_attribute : Returns information about text formatting.
4.       TE_get_text_line : Reads the text from the designated line in the terminal emulator screen.
5.       TE_get_cursor_pos :  Returns the current location of the cursor. 
6.       TE_set_cursor_pos : Sets the position of the cursor on the terminal screen.
7.       TE_getvar : Returns the value of an RTE system variable. 
8.       TE_setvar : Sets the value of an RTE system variable. 
9.        TE_perror : Prints an error code to the LoadRunner output window or Business Process Monitor agent log. 
10.    TE_sperror : Translates an error code into a string. 
11.    TE_send_text : Sends a null-terminated string to a VT terminal emulator. 
12.    TE_type : Sends a formatted string to the client application. 
13.    TE_typing_style : Determines the way text is typed into the terminal emulator. 
14.    TE_unlock_keyboard : Unlocks the keyboard of a mainframe terminal 
15.    TE_wait_cursor : Waits for the cursor to appear at a specified location in the terminal window. 
16.    TE_wait_silent : Waits for the client application to be silent for a specified number of seconds. 
17.    TE_wait_sync : Waits for the system to return from X-SYSTEM or Input Inhibited mode. 
18.    TE_wait_sync_transaction : Records the time that the system remained in the most recent X SYSTEM mode. 
19.    TE_wait_text : Waits for a string to appear in a designated location.

Correlation

Best simple way of correlation in RTE scripts to use TE_get_text_line function. Insert this statement at the location in script where the page having the required value will appear, Insert this function just after that to capture the value/Text at the specified location.
This value then can be passed in subsequent request wherever it’s needed
The following statement reads five characters of text from the 12th row and 20th column of the screen.
Char buf[50];
TE_get_text_line ( 20, 12, 5, buf);

RTE Synchronization

Depending on the system you are testing, you may need to synchronize the input that a Vuser sends to a terminal emulator with the subsequent responses from the server. When you synchronize input, you instruct the Vuser to suspend script execution and wait for a cue from the system, before the Vuser performs its next action. For instance, suppose that a human user wants to submit the following sequence of key strokes to a bank application:
·         Synchronizing Block-Mode (IBM) Terminals
·         Synchronizing Character-Mode (VT) Terminals

Synchronizing Block-Mode (IBM) Terminals

The TE_wait_sync function is used for synchronization RTE Vusers operating block-mode (IBM) terminals. Block-mode terminals display the "X SYSTEM" message to indicate that the system is in Input Inhibited mode. When a system is in the Input Inhibited mode no typing can take place because the terminal emulator is waiting for a transfer of data from the server.
When you record a script on a block-mode terminal, by default, VuGen generates and inserts a TE_wait_sync function into the script each time the "X SYSTEM" message appears. You use VuGen's recording options to specify whether or not VuGen should automatically insert TE_wait_sync functions.
When you run a Vuser script, the TE_wait_sync function checks if the system is in the X SYSTEM mode. If the system is in the X SYSTEM mode, the TE_wait_sync function suspends script execution. When the "X SYSTEM" message is removed from the screen, script execution continues.

Synchronizing Character-Mode (VT) Terminals

There are three types of synchronization that you can use for character-mode (VT) terminals

1.       Waiting for the Cursor to Appear at a Specific Location :
TE_wait_cursor function instructs a Vuser to suspend script execution until the cursor appears at a specified location on the screen. The appearance of the cursor at the specified location means that the application is ready to accept the next input from the terminal emulator.
2.       Waiting for Text to Appear on the Screen :
Text synchronization uses the TE_wait_text function. During script execution, the TE_wait_text function suspends script execution and waits for a specific string to appear in the terminal window before continuing with script execution. Text synchronization is useful with those applications in which the cursor does not consistently appear in a predefined area on the screen.
3.       Waiting for the Terminal to be Silent :
TE_wait_silent function to instruct a script to wait for the terminal to be silent. You specify the period for which the terminal must be silent. If the terminal is silent for the specified period, then the TE_wait_silent function assumes that the application has stopped printing text to the terminal screen, and that the screen has stabilized
Note: Use silent synchronization only when neither cursor synchronization nor text synchronization are effective.

Run-Time Settings

Run time settings of RTE protocol can be set through RTE node in the Run-Time settings
 Challenges
The following challenges are to be noted during RTE recording
·  As RTE protocol scripts records only key strokes so it demands knowledge of C language and good scripting skills to correlation and do error handling in script
·  Details of Terminal and Host
·  Knowledge of how to correlate and Parameterize in RTE scripts
·  Must have error handling in script by capturing data and text by RTE functions to avoid the script to go in failed state during the test.


20 comments:

  1. Hi ShashiKant,

    Its a very nice blog, I am working on Mainframe using LR, so continuously looking for help here.

    Can you please let me know if we have any function in RTE which behaves same as Web_global_verification for http.

    Thanks
    Manish

    ReplyDelete
    Replies
    1. Thanks Manish.
      Please import the relevant header files for web_global_verification function in your script, by default it is not there with RTE protocol, Also you can merge HTTP/HTML protocol with your RTE script by editing your .usr file.

      Delete
  2. Hi,
    I have been running load tests on an application using RTE. It appears to be working with the sync functions I have put in but I am seeing the odd failure now and again. i have no idea how to analyse these failures other than to get some kind of screen shot. Is there a way to enable a screenshot on demand when a transaction fails?

    ReplyDelete
    Replies
    1. Hi Craig,
      RTE protocol scripting and correlation is command based, It records only key strokes and any condition handling requires code in C or default LR functions, Please check whether all the key strokes being passed at the right place, also enabling the log will give the Terminal emulator snapshot in the output window so you can figure out from there as well.

      Delete
  3. How to skip the field if it is not found on RTE Screen?, How the script will run for the next Fields in screen.
    In My Case there is input which will go through the few fields in screen and If i parametrize the Input filed, the next input value may not go to the same fields as i recorded the script, in this case how to make the script work smoothly by skiiping that fields if it is not worthy for particular input. THanks

    ReplyDelete
  4. Very good knowledge base for RTE, Shashikant !!
    Hope you will post something on the analysis part for Mainframe issues, bottlenecks etc.

    Thanks,
    Rushikesh

    ReplyDelete
  5. Hi I am getting error while executing load with simultaneously hits the users on AS400. error message like


    vuser_init.c(17): Error: TE_connect failed after 1 tries. Giving up.
    Reason: Timeout.
    The error message is: Attempt to connect to host timed out.
    During connection of comm-type = tn5250;host-name = FOHDEV2;telnet-port = 992;device-name = FOHDEV2;auto-signon = false;user-name = ;password = ;security-type = ssl;ssl-type = tls1;terminal-type = 5250 display;terminal-model = 3477-fc;login-command-file = ;terminal-setup-file = ;

    ReplyDelete
  6. this blog contains excellent information..it's really very nice...loadrunner online training

    ReplyDelete
  7. Hi Sashikanth,

    Currently iam working on RTE protocol for one of the project.
    When logging manulaly using putty we are using XtremR6 as Function keys and keypads under putty configuration. We are able to brwsw through all the screen.
    Whne Iam trying to record using VUgen using RTE protocol, After logging i need to select F1 to F5 functions keys from keyboard inorder to enter into application, But th F1 to F5 function keys are not working.

    Any help on this much appreciated.

    Thanks in advance.

    ReplyDelete
  8. Hi Srinivas,

    Use the following workaround "kpf1, kpf2... kpf5"

    ReplyDelete
  9. Hi,

    I am getting timed out error in RTE protocol while running with more than 21 vusers.... manually I can login to more than 50 sessions.
    Can you please let me know possible reason.

    Thanks in Advance :)

    ReplyDelete
  10. Nice article.
    I am looking for any alternative or keystroke to capture the session step by step screenshot as test evidence, any suggestions in order to doing so?

    ReplyDelete
  11. Hello
    when i replay my RTE script , the TE_Connect go to timeout .

    vuser_init.c(16): Error: TE_connect failed after 1 tries. Giving up.
    Reason: Timeout.
    please , can you explain me why

    ReplyDelete
  12. How to check the given cursor position is editable or not.

    ReplyDelete
  13. Hi iam getting the below error for wait sync transaction eventhough declaration are correct, can you please confirm
    Error: TE_wait_sync_transaction failed: var = 35, Bad argument

    Declaration is :TE_wait_sync_transaction("syncTrans1");

    ReplyDelete
  14. I am not able to print à in mainframe (qws3270) emulator with RTE protocol, please help how to print à in emulator using RTE protocol

    ReplyDelete