Wednesday, July 3, 2013

AJAX Protocol in Load runner

AJAX (Asynchronous JavaScript and XML) is a technique for creating interactive Web applications. With AJAX, Web pages exchange small packets of data with the server, instead of reloading an entire page. This reduces the amount of time that a user needs to wait when requesting data. It also increases the interactive capabilities and enhances the usability.
Using AJAX, developers can create fast Web pages using Javascript and asynchronous server requests. The requests can originate from user actions,timer events, or other predefined triggers.AJAX components, also known as AJAX controls, are GUI based controls that use the AJAX technique—they send a request to the server when trigger occurs.

For example, a popular AJAX control is a Reorder List control that lets you drag components to a desired position in a list. VuGen’s support for AJAX implementation is based on Microsoft’s ASP.NET AJAX Control Toolkit formerly known as Atlas.

AJAX Supported Frameworks

The supported frameworks for AJAX functions are:
  • Atlas 1.0.10920.0/ASP.NET AJAX—All controls
  • Scriptaculous 1.8—Autocomplete, Reorder List, and Slider


VuGen supports the following frameworks at the engine level. This implies
that VuGen will create standard Web Click and Script steps, but not AJAX
specific functions:
  •  Prototype 1.6
  •  Google Web Toolkit (GWT) 1.4


AJAX Example Script

VuGen uses the control handler layer to create the effect of an operation on a GUI control. During recording, when encountering one of the supported AJAX controls, VuGen generates a function with an ajax_xxx prefix. In the following example, a user selected item number 1 (index=1) in an
Accordion control. VuGen generated an ajax_accordion function.

Note: When you record an AJAX session, VuGen generates standard Web (Click and Script) functions for objects that are not one of the supported AJAX controls. In the example above, the word FILE_PATH was typed into an edit box.

web_browser("Accordion.aspx",

DESCRIPTION,
ACTION,
"Navigate=http://labm1app08/AJAX/Accordion/Accordion.aspx",
LAST);
lr_think_time(5);
ajax_accordion("Accordion",
DESCRIPTION,
"Framework=atlas",
"ID=ctl00_SampleContent_MyAccordion",
ACTION,
"UserAction=SelectIndex",
"Index=1",
LAST);
web_edit_field("free_text_2",
"Snapshot=t18.inf",
DESCRIPTION,
"Type=text",
"Name=free_text",
ACTION,
"SetValue=FILE_PATH",
LAST);

 Note: When you record an AJAX session, VuGen generates standard Web (Click and Script) functions for objects that are not one of the supported AJAX controls. In the example above, the word FILE_PATH was typed into an edit box.

Recording Tips for Click And Script protocols in Load runner

Use the mouse and not the keyboard
It is preferable to click on an object with the mouse rather then using the
keyboard. During recording, use only GUI objects that are within the
browser's pane. Do not use any browser icons, controls, the Stop button, or
menu items, such as View > Refresh. You may, however, use the Refresh,
Home, Back and Forward buttons and the address bar.

Do not record over an existing script
It is best to record into a newly created script—not an existing one.

Avoid context menus
Avoid using context menus during recording. Context menus are menus
which pop up when clicking an item in a graphical user interface, such as
right-click menus.

Avoid working in another browser while recording
During recording, do not work in any browser window other than the
browser windows opened by VuGen.

Wait for downloads
Wait for all downloads to complete before doing any action, such as clicking
on a button or filling in a text field.

Wait for pages to load
During recording, it is best to wait for the page to load completely before
doing the next step. If you did not wait for all of the pages to load, record
the script again.

Navigate to start page
If the last page in an action does not contain the links and buttons that were
available at the start of the iteration, then the next iteration will fail. For
example, if the first page has a text link Book A Flight, make sure to navigate
to the appropriate page at the end of your recording, so that the same link
will be visible at the end of the business process.

Use a higher event configuration level
Record the business process again the High Event Configuration level. 

Disable socket level recording
In certain cases, the capturing of the socket level messages disrupts the
application. For most recordings, socket level data is not required. To
prevent the recording of socket level data, disable the option in the
recording options. For more information, see the section about recording
with Click and Script.

Enable the record rendering-related property values
If the client-side scripts of the application use a lot of styling activities,
enable the Record rendering-related property values option before
recording the script. For example, enable this option to record additional
DOM properties such as offsetTop. Note that enabling this option may
decrease the recording speed. You can enable the Recording Options > GUI
Properties > Advanced node

Replay Tips

The following section lists tips for replaying click and script scripts.
Do not reorder
Do not change the order of the statements within a recorded script. Also,
copying segments of code from one Action to another is not recommended.

Convert non-ASCII characters
If your links contain non-ASCII characters, you should instruct VuGen to
convert the data to or from the UTF-8 format.
To enable UTF-8 conversion:
➤ Open the Recording Options. Select Vuser > Run-Time Settings and select
the Internet Protocol > Preferences node.
➤ Click Options to open the Advanced Options dialog box.
➤ Locate the Convert from/to UTF-8 option and set it to Yes.
Alternatively, view the list of alternatives that are displayed when a link is
not found. Enter the displayed text as-is, such as the hex escape sequences
\xA0 or any other non-standard format.

Run same sequence of actions twice
In some cases, you can only perform a certain process once, such as deleting
a user from the database. Replay will fail after the first iteration, because the
action in no longer valid. Verify that your business process can be repeated
in the application more than once with the same data, without recording.

Set unique image properties
In Tree view, double click on the previous image step to open its properties.
If the Id, Name, and Alt properties are empty, provide further identification
of the image, such as its file name in the Src property.
Alternatively, you add an Ordinal argument to specify the occurrence
number of the image on that page. The Ordinal argument uniquely
identifies each image on the page where all other identification arguments
are not unique. For more information, see the Online Function Reference
(Help > Function Reference).

Check the step’s description
If you receive an error GUI Object is not found, check the Replay Log in the
Output window, for a list of the objects in the problematic step. In some
cases, the object description changes slightly from run to run.

There are several solutions:
➤ If the new value is stable, open the Script View and manually modify the
value of the step’s DESCRIPTION argument.

➤ If the description changes from run to run, you can use a regular
expression in the DESCRIPTION argument. For more information, see the
Online Function Reference (Help > Function Reference).

➤ Alternatively, replace the problematic object description property, such as
Name, with the Ordinal property For more information, see the Online
Function Reference (Help > Function Reference).

Miscellaneous Tips
The following additional tips may help you in troubleshooting your
problems:

Search for warnings
Search for warnings or alerts in the Replay Log.

Verify the response
Verify the response of the previous step is correct using web_reg_find. For
more information, see the Online Function Reference (Help > Function
Reference).

Use alternate navigation
For problematic steps or those using Java applets, Use Alternative
Navigation to replace the Web (Click and Script) step with an HTTP level
step. Note that the HTTP level steps may require manual correlations. To
perform Alternative Navigation, select a step in Tree View, or the text in
Script View, and select Replace with alternative navigation from the
right-click menu.

Working with the Kerberos Protocol

If you are using the Kerberos Protocol for authentication, you must
customize VuGen to properly convene authorization sessions. Advanced
users can attempt to perform this customization themselves.
In order for the Kerberos Protocol to work properly, create a krb5.ini file and
put it in an available directory. Save the full path name of krb5.ini into the
KRB5_CONFIG environment variable.
The krb5.ini file should contain detailed information about each domain
(KDS and AS addresses) and trust chains.
For more information, contact HP software support.

How to Configure the SAP Environment-SAP Protocol In Load runner


This task describes configure and verify the SAP environment for use with
VuGen.

VuGen support for the SAPGUI for Windows client, is based on SAP's
Scripting API. This API allows Vusers to interact with the SAPGUI client,
receive notifications, and perform operations.

The Scripting API is only available in recent versions of the SAP Kernel. In
kernel versions that support scripting, the option is disabled by default. In
order to use VuGen, first make sure that the SAP servers support the
Scripting API, and enable the API on both the server and clients. For more
information and to download patches, see the SAP OSS note #480149.
VuGen provides a utility that checks if your system supports scripting. The
utility, VerifyScript.exe, is located on DVD in the Additional
Components\SAP_Tools\VerifySAPGUI folder. For more information, see
the file VerifyScripting.htm provided with this utility.

Checking the SAPGUI for Windows client patch level
You can check the patch level of your SAPGUI for Windows client from the
About box. The lowest patch level supported is version 6.20 patch 32.

To check the patch level:

1 Open the SAPGUI logon window. Click the top left corner of the SAP
Logon dialog box and select About SAP Logon from the menu.
2 The SAP version information dialog box opens. Verify that the Patch
Level entry is 32 or higher.

Check the kernel patch level
1 Log in to the SAP system
2 Select System > Status
3 Click the Other kernel information button.
4 In the Kernel Information section, check the value of the Sup. Pkg. lvl.
The level must be greater than the level listed in the following chart
depending on the SAP version you are using.



Check the R/3 support packages

1 Log on to the SAP system and run the SPAM transaction.
                                   2 In the Directory section, select All Support Packages, and click the Display button.
           3 Verify that the correct package is installed for your version of SAP according to the table below



If the correct version is installed, a green circle appears in the Status
column.


If you do not have the OCS package installed, download it the from the
www.sap.com Web site and install it. For more information, see the SAP OSS
note #480149.

Enable scripting on the SAP application server:

A user with administrative permissions enables scripting by setting the
sapgui/user_scripting profile parameter to TRUE on the application server.
To enable scripting for all users, set this parameter on all application servers.
To enable scripting for a specific group of users, only set the parameter on
application servers with the desired access restrictions.
To change the profile parameter:

1 Open transaction rz11. Specify the parameter name sapgui/user_scripting
and click Display. The Display Profile Parameter Attributes window opens.




If Parameter name is unknown appears in the status bar, this indicates
that you are missing the current Support Package. Import the Support
Package that corresponds to the SAP BASIS and kernel versions of the
application server, as described in the steps above.

2 If Profile Val is FALSE, you need to modify its value. Click the Change
value button in the toolbar. The Change Parameter Value window opens.
Enter TRUE in the ProfileVal box and click the Save button.
When you save the change, the window closes and ProfileVal is set to
TRUE.
3 Restart the application server, since this change only takes effect when
you log onto the system.
If the updated ProfileVal did not change, even after restarting the server,
then the kernel of the application server is outdated. Import the required
kernel patch, as specified in the steps above.

Note that the Profile Value may be dynamically activated in the following
kernel versions, using transaction rz11, without having to restart the
application server.

Enable scripting on SAPGUI 6.20 client:

To allow VuGen to run scripts, you must also enable scripting on the
SAPGUI client. You should also configure the client not to display certain
messages, such as when a connection is established, or when a script is
attached to the GUI process.
To configure the SAPGUI client to work with VuGen:
1 During installation. While installing the SAPGUI client, enable the SAP
GUI Scripting option.



2 After installation. Suppress warning messages. Open the Options dialog
box in the SAPGUI client. Select the Scripting tab and clear the following
options:
- Notify when a script attaches to a running GUI
-Notify when a script opens a connection
You can also prevent these messages from popping up by setting the
values WarnOnAttach and WarnOnConnection in the following
registry key to 0:

HKCU\SOFTWARE\SAP\SAPGUI Front\SAP Frontend Server\Security

SAP Web Protocol in Load runner

The SAP-Web Vuser script typically contains several SAP transactions which
make up a business process. The business process consists of functions that
emulate user actions. For information about these functions, see the Web
functions in the Online Function Reference (Help > Function Reference).

Example:


The following example shows a typical recording for a SAP Portal client:


vuser_init()

{
web_reg_find("Text=SAP Portals Enterprise Portal 5.0",
LAST);
web_set_user("junior{UserNumber}",
lr_decrypt("3ed4cfe457afe04e"),
"sonata.hplab.com:80");
web_url("sapportal",
"URL=http://sonata.hplab.com/sapportal",
"Resource=0",
"RecContentType=text/html",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/SAPPortal/IE/Media/sap_mango_polarwind/images/header/
branding_image.jpg", "Referer=http://sonata.hplab.com/hrnp$30001/
sonata.hplab.coml:80/Action/26011[header]", ENDITEM,
"Url=/SAPPortal/IE/Media/sap_mango_polarwind/images/header/logo.gif",
"Referer=http://sonata.hplab.com/hrnp$30001/sonata.hplab.com:80/Action/
26011[header]", ENDITEM,


LAST);

The following section illustrates a SAP Web and SAPGUI multi-protocol

recording in which the Portal client opens a SAP control. Note the switch

from web_xxx to sapgui_xxx functions


web_url("dummy",

"URL=http://sonata.hplab.com:1000/hrnp$30000/sonata.hplab.com:1000/
Action/
dummy?PASS_PARAMS=YES&dummyComp=dummy&Tcode=VA01&draggable=0&C
ompFName=VA01&Style=sap_mango_polarwind",
"Resource=0",
"RecContentType=text/html",
"Referer=http://sonata.hplab.com/sapportal",
"Snapshot=t9.inf",
"Mode=HTML",
LAST);
sapgui_open_connection_ex(" /H/Protector/S/3200 /WP",
"",
"con[0]");
sapgui_select_active_connection("con[0]");
sapgui_select_active_session("ses[0]");
/*Before running script, enter password in place of asterisks in logon function*/
sapgui_logon("JUNIOR{UserNumber}",
"ides",
"800",
"EN",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui102",
END_OPTIONAL);

SAP (Click and Script) Protocol in Load runner

VuGen can create test scripts for SAP Enterprise portal7 and SAP ITS 6.20/ 6.40 environments using specialized test objects and methods that have been customized for SAP. The objects are APIs based on HP QuickTest support for SAP.

As you record a test or component on your SAP application, VuGen records the operations you perform. VuGen recognizes special SAP Windows objects such as frames, table controls, iViews, and portals.

VuGen supports recording for the following SAP controls: button, checkbox,drop-down menu, edit field, iview, list, menu, navigation bar, OK code,portal, radio group, status bar, tab strip, table, and tree view.VuGen uses the control handler layer to create the effect of an operation on a GUI control. During recording, when encountering one of the supported
SAP objects, VuGen generates a function with an sap_xxx prefix.
Example:In the following example, a user selected the User Profile tab. VuGen
generated a sap_portal function

web_browser("Close_2",
"Snapshot=t7.inf",
DESCRIPTION,
"Ordinal=2",
ACTION,
"UserAction=Close",
LAST);

lr_think_time(7);
web_text_link("Personalize",
"Snapshot=t8.inf",
DESCRIPTION,
"Text=Personalize",
ACTION,
"UserAction=Click",
LAST);

lr_think_time(6);

sap_portal("Sap Portal_2",
"Snapshot=t9.inf",
DESCRIPTION,
"BrowserOrdinal=2",
ACTION,
"DetailedNavigation=User Profile",
LAST);

Note: When you record a SAP (Click and Script) session, VuGen generates standard Web (Click and Script) functions for objects that are not SAP-specific. You do not need to explicitly specify the Web protocol. In the example above, VuGen generated a web_text_link function when the user clicked the Personalize button.

Replaying SAPGUI Optional Windows-SAP Protocol In Load runner

When working with SAPGUI Vuser Scripts, you may encounter optional windows in the SAPGUI client—windows that were present during recording, but do not exist during replay. If you try to replay your recorded script as is, it will fail when it attempts to find the missing windows.

VuGen’s optional window mechanism performs the actions on a window only after verifying that it exists. The Vuser checks if the window indicated in the Select active window step exists. If the window is found during replay, it performs the actions as they were recorded in the script. If it does not exist, the Vuser ignores all window actions until the next Select active window step. Note that only SAPGUI steps (beginning with a sapgui prefix)
are ignored.

To use this feature, in Tree view select the appropriate Select Active Window step and select Run steps for window only if it exists from the right-click menu.

To disable this feature and attempt to run these steps at all times, regardless of whether the Vuser finds the window or not, select Always run steps for this window from the right-click menu.

How to Insert Caching Functions in Web(Http/Html) Protocol in Load runner


This task describes how to use caching functions. Caching functions allow
you to save stored data into your browser’s cache, and load it at a later point
in the script. 

To use the caching functions:

1 Insert the web_dump_cache function into your script.

2 Run the script at least once.

3 Insert the web_load_cache function into your script before the Vuser
actions.

4 Comment out the web_dump_cache function.

5 Run and save the script.

Example:
The following example illustrates a PeopleSoft Enterprise Vuser viewing the
details of his paycheck

Action()
{
// web_add_cookie("storedCookieCheck=true; domain=pbntas05; path=/");
web_load_cache("ActionLoad","FileName=c:\\temp\\{VuserName}paycheck",LAST);
web_browser("signon.html",
DESCRIPTION,
ACTION,
"Navigate=http://pbntas05:8200/ps/signon.html",
LAST);
lr_think_time(35);
web_edit_field("userid",
"Snapshot=t1.inf",
DESCRIPTION,
"Type=text",
"Name=userid",
ACTION,
"SetValue={VuserName}",
LAST);
web_edit_field("pwd",
"Snapshot=t2.inf",
DESCRIPTION,
"Type=password",
"Name=pwd",
ACTION,
"SetValue=HCRUSA_KU0007",
LAST);
lr_start_transaction("login");
web_button("Sign In",
"Snapshot=t3.inf",
DESCRIPTION,
"Type=submit",
"Tag=INPUT",
"Value=Sign In",
LAST);
lr_end_transaction("login", LR_AUTO);
web_image_link("CO_EMPLOYEE_SELF_SERVICE",
"Snapshot=t4.inf",
DESCRIPTION,
"Alt=",
"Name=CO_EMPLOYEE_SELF_SERVICE",
"Ordinal=1",
ACTION,
"ClickCoordinate=10,10",
LAST); …
web_text_link("Sign out",
"Snapshot=t7.inf",
DESCRIPTION,
"Text=Sign out",
"FrameName=UniversalHeader",
ACTION,
"UserAction=Click",
LAST);
/*web_dump_cache("paycheck","FileName=c:\\{VuserName}paycheck",
"Replace=yes", LAST);*/
return 0;
}

Text and Image Checkpoints in Web (Http/Html )Protocol in load runner

There are a number of different types of checks that VuGen can add to your
script.
Add a text check during recording

1 In the application or Web browser window, select the desired text.

2 Click the Insert Text check button on the recording toolbar. VuGen adds a
web_reg_find function to the script.

Add a text check (after recording)

1 Go to the snapshot of the step whose text you want to check.

2 In the snapshot, select the text you want to verify.

3 Select Add a Text Check (web_reg_find) from the right-click menu and
complete the Find Text properties dialog box. For more details, hit F1
when in the dialog box to open the function reference.

Add other text checks (after recording)

1 Select the step that contains the image you want to verify.

2 Select Insert > New Step.

a For the web_find function, expand the Web Checks node and select
Text Check.
b For the web_global_verification function, expand the Services node
and select the function name.

3 Complete the dialog box. For more details, hit F1 when in the dialog box
to open the function reference.

Add an image check (after recording)

1 Select the step that contains the image you want to verify.

2 Select Insert > New Step > Web Checks > Image Check.

3 Complete the Image Check Properties dialog box. For more details, hit F1
when in the dialog box to open the function reference.

Dealing with XML Pages in web (Http/Html) Protocol in Load runner


VuGen supports record and replay for XML code within Web pages.
The XML code can appear in the script as a regular URL step or as a custom
request. VuGen detects the HTML and allows you to view each document
type definition (DTD), its entities, and its attributes. VuGen can interpret
the XML when the MIME type displayed in the RecContentType attribute or
the MIME type returned by the server during replay, ends with xml, such as
application/xml or text/xml. The DTD is color coded, allowing you to
identify each one of the elements. You can also expand and collapse the tree
view of the DTD.

When you expand the DTD, you can parameterize the attribute values. You
can also save the values in order to perform correlation using the standard
correlation functions.

 For more information about the correlation
functions, see the Online Function Reference (Help > Function Reference).

Note: VuGen cannot display a DTD with XML islands, segments of XML
embedded inside an HTML page. VuGen only displays pages that are
entirely XML.

Web (HTTP/HTML) Protocol in Load runnner

When recording a Web (HTTP/HTML) script, VuGen records the HTTP traffic
between the browser and the server. The scripts contain detailed
information about the recorded traffic.

The Web (HTTP/HTML) Vuser provides two recording levels: HTML-based
script and URL-based script. These levels lets you specify what information
to record and which functions to use when generating a Vuser script. For
more information about selecting a Recording level, 

Tip: For most applications, including those with JavaScript, use Web (Click
and Script) Vusers. For browser applications with applets and VB Script or
for non-browser applications, use the Web (HTTP/HTML) Vuser.

Support for Push Technology:

Vuser scripts run steps sequentially, one step cannot start until the previous
step has completed. A step does not complete until all requested data has
finished downloading. Some websites use push technology in which
downloads are not meant to complete. Data is periodically downloaded as
updates occur.

When a Vuser script contains steps which access resources using push
technology, the Vuser script gets stuck on the step until a timeout occurs.
This is a “false” timeout because the site is functioning as designed.

Expert users can work around this problem by changing the conditions for
the step to complete. For more information, see the
web_reg_cross_step_download function in the Online Function Reference
(Help > Function Reference).

Working with Cache Data:

You can save stored data into your browser’s cache, and load it at a later
point in the script.

To implement this within your script, you manually add the
web_dump_cache and web_load_cache functions.

Dumping Information to the Cache
Transferring data to the cache is called dumping the information. You run
the web_dump_cache function to create a cache file in the location
specified in the FileName argument. You only need to run this function
once to generate the cache file.

In the following example, the web_dump_cache function creates a cache file
in C:\temp for each VuserName parameter running the script.

web_dump_cache("paycheckcache","FileName=c:\\temp\\{Vuser
Name}paycheck", "Replace=yes", LAST)

If you run a single Vuser user ten times, VuGen creates ten cache files in the
following format, where the prefix is the VuserName value:

You can modify the first and second arguments (paycheckcache and
paycheck in this example) to reflect the current transaction name. Place this
function at the end of your script, after you have loaded all of the resources.
Loading Information from the Cache

The web_load_cache function loads a cache file whose location is specified
in the FileName argument. Note that the web_load_cache function requires
the cache file to exist. Therefore, you can only run this function after
running web_dump_cache.

In the following example, the web_load_cache function loads the paycheck
cache files from C:\temp

web_load_cache("ActionLoad","FileName=c:\\temp\\{VuserName}paycheck",LAST)

SAP Protocol in LoadRunner-Selecting a SAP Protocol Type


To test the SAPGUI user operating only on the client, use the SAPGUI Vuser 
type. To test a SAPGUI user that also uses a Web browser, use the SAP (Click and Script) or SAP-Web protocol.

To record a SAPGUI session that uses browser controls, create a 
multi-protocol Vuser script with the SAPGUI and SAP-Web protocols. This allows VuGen to record Web-specific functions when encountering the browser controls. This will not work if you attempt to combine SAPGUI and Web protocols.

Before recording a session, verify that your modules and client interfaces are  
supported by VuGen. The following table describes the SAP client modules for SAP Business applications and the relevant tools:

SAP module                                                            VuGen support


SAP Web Client or                                                 Use the SAP-Web protocol.

mySAP.com.

SAPGUI for Windows.---------Use the SAPGUI protocol.This also supports APO module                recording(requires patch level 24 forAPO 3.0 for SAP 6.20).


SAPGUI for Windows and

a web browser:----Use the SAP (Click and Script) protocol.

SAPGUI for Java.:-----This client is not supported.

                         

RTE Protocol in load runner-How to Implement Continue on Error

To configure the Continue on Error functionality in RTE Scripts:

➤ To continue running the script on error, insert the following function:

TE_setvar(TE_IGNORE_ERRORS, 1)



➤ To restore the default behavior of failing the script on error, insert the

following function:


TE_setvar(TE_IGNORE_ERRORS, 0)

How to Record RTE Scripts-RTE Protocol in Load runner

You use VuGen to record Windows-based RTE Vuser scripts. VuGen uses the
PowerTerm terminal emulator to emulate a wide variety of terminal types.
This task describes how to record RTE scripts. This procedure differs from
the general recording procedure 

1 Record the terminal setup and connection
a Open an existing RTE Vuser script, or create a new one.

b In the Sections box, select the vuser_init section to insert the recorded
statements.

c In the Vuser script, place the cursor at the location where you want to
begin recording.

d Click the Start Record button. The PowerTerm main window opens.

e From the PowerTerm menu bar, select Terminal > Setup to display the
Terminal Setup dialog box.

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

g Select Communication > Connect to display the Connect dialog box.

h Under Session Type, select the type of communication to use.

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

Tip: Click Save As to save the parameter-sets for re-use in the future. The
parameter-sets that you save are displayed in the Sessions List box.

j 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 terminal type is VT 100. */
TE_connect(
"comm-type = telnet;"
"host-name = alfa;"
"telnet-port = 992;"
"terminal-id = ;"
"set-window-size = true;"
"security-type = ssl;"
"ssl-type = tls1;"
"terminal-type = vt100;"
"terminal-model = vt100;"
"login-command-file = ;"
"terminal-setup-file = ;"
, 60000);
if (TE_errno != TE_SUCCESS)
return -1;

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.

2 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.
a Select the Actions section in the Section box.

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

3 Record the log-off procedure

a Make sure that you have performed and recorded the typical user
actions as described in the previous section.

b In the VuGen main window, click vuser_end in the Section box.

c Perform the log off procedure. VuGen records the procedure into the
vuser_end section of the script.

d Click Stop Recording on the Recording toolbar. The main VuGen
window displays all the recorded statements.

e Click Save to save the recorded session. After recording a script, you
can manually edit it in VuGen’s main window.

RTE Protocol-Reading Text from the Terminal Screen


There are several Vuser functions that RTE Vusers can use to read text from
the terminal screen. You can use these functions, TE_find_text and
TE_get_text_line, to check that the terminal emulator is responding
correctly, or to enhance the logic in your scripts.

After recording, you can manually insert TE_find_text and TE_get_text_line
statements directly into your RTE Vuser scripts.
Searching for Text on the Screen

The TE_find_text function searches for a line of text on the screen. The
syntax of the function is:
int TE_find_text (char *pattern, int col1, int row1, int col2, int row2,
int *retcol, int *retrow, char *match);

This function searches for text matching pattern within the rectangle
defined by col1, row1, col2, row2. Text matching the pattern is returned to
match, and the actual row and column position is returned to retcol and
retrow. The search begins in the top-left corner. If more than one string
matches pattern, the one closest to the top-left corner is returned.
The pattern can include a regular expression. See the Online Function
Reference for details on using regular expressions.

You must manually type TE_find_text statements into your Vuser scripts. For
details on the syntax of the TE_find_text function, see the Online Function
Reference (Help > Function Reference).
Reading Text from the Screen
The TE_get_text_line function reads a line of text from the area of the screen
that you designate. The syntax of the function is:
char *TE_get_text_line (int col, int row, int width, char *text);

This function copies a line of text from the terminal screen to a buffer text.
The first character in the line is defined by col, row. The column coordinate
of the last character in the line is indicated by width. The text from the
screen is returned to the buffer text. If the line contains tabs or spaces, the
equivalent number of spaces is returned.

In addition, the TE_get_cursor_position function can be used to retrieve the
current position of the cursor on the terminal screen. The
TE_get_line_attribute function returns the character formatting (for
instance, bold or underline) of a line of text.

You must manually type TE_get_text_line statements into your Vuser
scripts. For details on the syntax of the TE_get_text_line function, see the
Online Function Reference (Help > Function Reference).

RTE Protocol in Load runnner

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 could use RTE Vusers to emulate this case. An 

RTE Vuser would:
1 Type 60 at the command line to open an application program.
2 Type F296, the field service representative’s number.
3 Type NY270, the customer number.
4 Wait for the word "Details" to appear on the screen. The appearance of "Details" indicates that all the customer details are displayed on the screen.
5 Type Changed gasket P249, and performed Major Service the details of the current repair.
6 Type Q to close the application program.

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.

The functions developed to emulate a terminal communicating with a server are called TE Vuser functions. Each TE Vuser function has a TE prefix.VuGen automatically records most of the TE functions listed in this section during an RTE session. You can also manually program any of the functions into your 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.

Working with Ericom Terminal Emulation

VuGen supports record and replay with Ericom Terminal Emulators.The Ericom support handles escape sequences during record and replay.Ericom’s PowerTerm lets you map PC keys to custom escape sequences. For information about mapping, see the PowerTerm help.
When a user presses mapped keys while recording an Ericom VT session, VuGen generates TE_send_text functions instead of the standard TE_type.This allows the script to handle custom escape sequences in a single step.
SSL and SSH Support for Ericom

VuGen also supports SSL/SSH record and replay for the RTE Ericom library.To work with SSL or SSH, you select the type in the Security section of the Connect dialog box.When working with SSH Security, by default VuGen opens a popup dialog box prompting you for more information. We recommend that you disable the Show options to prevent the pop-ups from being issued. If you enable these pop-ups, it may affect the replay. You can access the advanced security options by clicking the Details button.




Typing Input into a Terminal Emulator:
Two TE Vuser functions enable Vusers to "type" character input into the

PowerTerm terminal emulator:


➤ TE_type sends characters to the terminal emulator. When recording, the VuGen automatically generates TE_type functions for keyboard input to the terminal window. For details, see below.
➤ TE_typing_style determines the speed at which the Vuser types. You can manually define the typing style by inserting a TE_typing_style function into the Vuser script. For details, see "Setting the Typing Style". Alternatively, you can set the typing style by using
the run-time settings.  "Run-Time Settings".

Note: While recording an RTE Vuser script, do not use the mouse to relocate the cursor within the terminal emulator window. VuGen does not record these cursor movements.

Using the TE_type Function

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.Keyboard input is defined as a regular text string (including blank spaces).

For example:
TE_type ("hello, world");
Input key names longer than one character for example, the following function depicts the input of the Return key followed by the Control and y keys:

TE_type("");

Some other examples include: , , , , .To determine a key name, record an operation on the key, and then check the recorded statement for its name.

Note: When you program a TE_type statement (rather than recording it),use the key definitions provided in the Online Function Reference (Help >Function Referenc
Setting the Timeout Value for TE_type
If a Vuser attempts to submit a TE_type statement while the system is in

X SYSTEM (or input inhibited) mode, the Vuser will wait until the
X SYSTEM mode ends before typing. If the system stays in X SYSTEM mode for more than TE_XSYSTEM_TIMEOUT milliseconds, then the TE_type function returns a TE_TIMEOUT error. You can set the value of TE_XSYSTEM_TIMEOUT by using TE_setvar. The default value for TE_XSYSTEM_TIMEOUT is 30 seconds.Allowing a Vuser to Type Ahead Under certain circumstances you may want a Vuser to submit a keystroke
even though the system is in X SYSTEM (or input inhibited) mode. For example, you may want the Vuser to press the Break key. You use the TE_ALLOW_TYPEAHEAD variable to enable the Vuser to submit a keystroke even though the system is in X SYSTEM mode.
Set TE_ALLOW_TYPEAHEAD to zero to disable typing ahead, and to any non-zero number to permit typing ahead. You use TE_setvar to set the value of TE_ALLOW_TYPEAHEAD. By default, TE_ALLOW_TYPEAHEAD is set to zero, preventing keystrokes from being sent during X SYSTEM mode. Setting the Field Demarcation Characterssome terminal emulators use demarcation characters to mark the beginning and the end of each field. These demarcation characters are not visible— appearing on the screen as spaces. In the terminal emulator shown below, the colors in the middle section of the screen have been inverted to display the field demarcation characters. These characters are surrounded by ellipses.

The TE_wait_text, TE_get_text, and TE_find_text functions operate by identifying the characters in a specified portion of the screen. If a field demarcation character is located within the specified section, you can identify the character as a space or an ASCII character. You use the TE_FIELD_CHARS system variable to specify the method of identification.

You can set TE_FIELD_CHARS to 0 or 1:

➤ 0 specifies that the character in the position of the field demarcation characters is returned as a space.
➤ 1 specifies that the character in the position of the field demarcation characters is returned as an ascii code (ascii 0 or ascii 1).By default, TE_FIELD_CHARS is set to 0.
You retrieve and set the value of TE_FIELD_CHARS by using the TE_getvar and TE_setvar functions.