Tuesday 16 July 2013

LoadRunner::Replaces fragments ofan XML string

The lr_xml_replace function queries the XML input string XML for values matching the Query criteria and replaces them either with XmlFragment or XmlFragmentParam as the value of the elements matched by the query. You can replace elements by specifying either its element name or attribute in the XML Query. The resulting string is placed in ResultParam, using the source document encoding.

If there is more than one value to be replaced, then pass the “XmlFragmentParam=” specification. Save the values in a series of parameters with the names: param1..param2…param3…

where Param is the value “XmlFragmentParam=Param“. lr_xml_replace replaces each successive match of the Query with the value of the next parameter in the series.

int lr_xml_replace(
[,
] [, LAST]);
List of specifications
For the following list of required specifications, use the following string format: “Specification=value”
XML: the XML Input String to query
ResultParam: the name of the output parameter containing the XML data after replacing the new value
Query: the XML Query on the input string XML.

List of optional specifications
Choose one of the following:
XmlFragment: the string value to use as replacement of the query match—an element or an attribute. or:
XmlFragmentParam: the name of the parameter containing the string value to use as replacement
For the following list of optional specifications, use the following string format: “Specification=value”
SelectAll: If “yes”, all elements matching the query will be processed. If “no”, only the first match will be processed. Default is “no”.

Oracle NCA Protocol Overview in load runner

Oracle NCA is a protocol that handles communication with the Oracle Forms server. Using your browser, you launch the database client, an applet viewer. You perform actions on the NCA database through its applet viewer. This eliminates the need for client software and allows you to perform database actions from all platforms that support the applet viewer.

The NCA environment is a three-tier environment. The user first sends an http call from his browser to a Web server. This call accesses the startup HTML page which invokes the Oracle Applications applet. The client (appletviewer) communicates through the proprietary NCA protocol with the application server (Oracle Forms server) which then submits information to the database server. VuGen records and replays the NCA communication between the client and the Forms server (application server).

The Oracle NCA protocol is commonly used as a multi protocol in combination with Web (HTTP/HTML) or Web (Click and Script). This is the recommended way to record with Oracle NCA. If you are using Oracle NCA as a single protocol, web events are recorded but steps are not generated (or replayed) by default.

If you initially created a single protocol script for Oracle NCA, and at a later stage you require the Web functions for testing, you can regenerate your script in VuGen to add the Web functions, without having to re-record the session. You indicate this from the Protocols node in the Recording Options.

Oracle NCA Protocol Example Scripts:

In the following example, the user selected an item from a list (nca_list_activate_item), pressed a button (nca_button_press), retrieved a list value (nca_lov_retrieve_items), and performed a click in an edit field
(nca_edit_click). The logical names of the objects are the parameters of these functions.

nca_lov_select_item("Responsibilities","General Ledger, Vision Operations");
nca_list_activate_item("FNDSCSGN.NAVIGATOR.LIST.0","+ Journals");
nca_list_activate_item("FNDSCSGN.NAVIGATOR.LIST.0"," Enter");
nca_button_press("GLXJEENT.TOOLBAR.LIST.0");
nca_lov_find_value("Batches","");
nca_lov_retrieve_items("Batches",1,9);
nca_lov_select_item("Batches","AR 1020 Receivables 2537: A 1020");
nca_edit_click("GLXJEENT.FOLDER_QF.BATCH_NAME.0");

In certain tests, such as those performed on Oracle Configurator applications, information returned by one function is required throughout the session. VuGen automatically saves the dynamic information to a parameter, by inserting a web_reg_save_param function into the script. In the following example, the connection information is saved to a parameter called NCAJServSessionID.

web_reg_save_param ("NCAJServSessionId", "LB=\r\n\r\n", "RB=\r",
LAST);
web_url("f60servlet",
"URL=http://usscifforms05.sfb.na/servlet/f60servlet\?config
=mult", LAST);

In the above example, the right boundary is \r. The actual right boundary may differ between systems

Note: We recommend that the user not modify the web_reg_save_param parameters if it was generated automatically. Alternatively, you can manually add a new web_reg_save_param function or add a new
correlation rule.

Oracle NCA Record and Replay Tips:

When recording an Oracle NCA Vuser script, follow these guidelines:
➤ We recommend installing Jinitiator before recording a script.
➤ Close all browsers before you begin recording.
➤ Due to a Netscape limitation, you cannot launch an Oracle NCA session within Netscape when another Netscape browser is already running on the machine.
➤ Record the login procedure in the vuser_init section. Record a typical business process in the Actions section. When you run the script, you can then specify multiple iterations for a specific business process. 
➤ VuGen supports the recording of Oracle Forms applications using the Forms Listener Servlet in multi-protocol mode. The application server uses the Forms Listener Servlet to create a runtime process for each client. The runtime process, Forms Server Runtime, maintains a persistent connection with the client and sends information to and from the server.

To support Forms 4.5 in replay, modify the mdrv_oracle_nca.dat file in the dat > mdrv directory to match the following example:

[Oracle_NCA]
ExtPriorityType=protocol
WINNT_EXT_LIBS=ncarp110.dll
WIN95_EXT_LIBS=ncarp110.dll
LINUX_EXT_LIBS=liboranca.so
SOLARIS_EXT_LIBS=liboranca.so
HPUX_EXT_LIBS=liboranca.sl
AIX_EXT_LIBS=liboranca.so
LibCfgFunc=oracle_gui_configure
UtilityExt=lrun_api

To restore Forms support for versions later than 4.5, restore the original values.

Mailing Service Protocols Overview(IMAP,MAPI,POP3,SMTP PROTOCOLS ) in load runner

The Mailing Service protocols emulate a user working with an email client,
viewing and sending emails. The following mailing services are supported:

Internet Messaging (IMAP)
➤ MS Exchange (MAPI)
➤ Post Office Protocol (POP3)
➤ Simple Mail Transfer Protocol (SMTP)

The mail protocols support both record and replay, with the exception of MAPI that only supports replay.

IMAP Protocol Overview:

IMAP Vuser script functions record the Internet Mail Application Protocol. Recording is not supported for this protocol. Each IMAP function begins with an imap prefix.  In the following example, the imap_create function creates several new mailboxes: Products, Solutions, and FAQs

Actions()
{
imap_logon("ImapLogon",
"URL=imap://johnd:letmein@exchange.mycompany.com",
LAST);
imap_create("CreateMailboxes",
"Mailbox=Products",
"Mailbox=Solutions",
"Mailbox=FAQs",
LAST);
imap_logout();
return 1;
}


MAPI Protocol Overview:

MAPI Vuser script functions record activity to and from an MS Exchange server. Each MAPI function begins with a mapi prefix.

Note: To run MAPI scripts, you must define a mail profile on the machine running the script. For example, install Outlook Express, set it as the default mail client, and create a mail account. Alternatively, install Microsoft Outlook, set it as the default mail client, create a mail account and create a mail profile. To create a mail profile in Microsoft Outlook, select Settings > Control Panel > Mail > Show Profiles and add a mail profile.

In the following example, the mapi_send_mail function sends a sticky note through an MS Exchange server

Actions()
{
mapi_logon("Logon",
"ProfileName=John Smith",
"ProfilePass=Tiger",
LAST);
//Send a Sticky Note message
mapi_send_mail("SendMail",
"To=user1@techno.merc-int.com",
"Cc=user0002t@techno.merc-int.com",
"Subject=: @ ",
"Type=Ipm.StickyNote",
"Body=Please update your profile today.",
LAST);
mapi_logout();
return 1;
}

POP3 Protocol Overview:

POP3 Vuser script functions emulate actions using the Post Office Protocol,POP3. Each function begins with a pop3 prefix. In the following example, the pop3_retrieve function retrieves five messages from the POP3 server.

Actions()
{
pop3_logon("Login", "
URL=pop3://user0004t:my_pwd@techno.merc-int.com",
LAST);
// List all messages on the server and receive that value
totalMessages = pop3_list("POP3", LAST);
// Display the received value (It is also displayed by the pop3_list function)
lr_log_message("There are %d messages.\r\n\r\n", totalMessages);
// Retrieve 5 messages on the server without deleting them
pop3_retrieve("POP3", "RetrieveList=1:5", "DeleteMail=false", LAST);
pop3_logoff();
return 1;
}


SMTP Protocol Overview:

SMTP Vuser script functions emulate the Single Mail Transfer Protocoltraffic. Each SMTP function begins with an smtp prefix. .
In the following example, the smtp_send_mail function sends a mail
message, through the SMTP mail server, techno.

Actions()
{
smtp_logon("Logon",
"URL=smtp://user0001t@techno.merc-int.com",
"CommonName=Smtp Test User 0001",
NULL);
smtp_send_mail("SendMail",
"To=user0002t@merc-int.com",
"Subject=MIC Smtp: Sample Test",
"MAILOPTIONS",
"X-Priority: 3",
"X-MSMail-Priority: Medium",
"X-Mailer: Microsoft Outlook Express 5.50.400\r\n",
"X-MimeOLE: By Microsoft MimeOLE V5.50.00\r\n",
"MAILDATA",
"MessageText="
"Content-Type: text/plain;\r\n"
"\tcharset=\"iso-8859-1\"\r\n"
"Test,\r\n"
"MessageBlob=16384",
NULL);
smtp_logout();
return 1;
}