How to record and replay against Oracle Web Application 11i

How to record and replay against Oracle Web Application 11i

Introduction

Starting with LoadRunner8.0, LoadRunner comes with a Web GUI-level recording solution for Oracle Web Applications 11i. The recorder for this solution is able to create an object oriented script that accurately interprets Javascript on the Web pages commonly found on Oracle Web Applications 11i.

When you record a session, VuGen records all of the activity and creates a script. During replay, the script emulates the HTTP protocol communication between your browser and the server. This script can intuitively represent actions in the Oracle interface.

Requirements

1. LoadRunner 8.0 or higher

2. License for the ‘OracleWebJS’ Vuser

Supported Oracle Applications 11i

Following are the officially supported Oracle Application 11i:

• HR

• Financials

• IStore

• Marketing and Sales

Note: Even though not listed, there is a good chance that other Oracle Applications 11i will work with the solution. Mercury strongly encourages you to try it out if situation allows.

Supported OS

· Recording and Replay under Windows on IE only

· Replay under Unix – Solaris, Linux, HP and IBM

· If NCA functions are present then Linux platform is not supported.

Recording Oracle Web Application 11i script

1. From the ‘New Multiple Protocol Script’ window, add ‘Oracle Web Application 11i’ and click OK.

Note: Creating script with Multiple Protocol recorder provides the option to regenerate the script after recording (if necessary).

2. Set the following Recording Options:

a. Internet Protocol: Recording:

· Select GUI- based script’

· Click on ‘GUI Advanced’ and enable ‘Use HTML-based script as fallback’

· Click on ‘GUI Advanced’ and enable ‘Enable out-of-context recording

Note: You can refer to the books online for the detail about these options.

  1. Internet Protocol: Correlation:

a. Make sure that you have ‘Enable Correlation during recording’

b. Make sure that ‘Oracle’ is selected. You can expand the list to see the details about each rule if you wish.

  1. All the other recording options are optional. Modify them if necessary to fit your test requirement. Otherwise, leave them as default.

Replaying Oracle Web Application 11i script

With the Oracle Web Application 11i script, Mercury is offering a zero correlation solution. This means that you do not have to worry about handling the dynamic values such as session ID being recorded into the script. After recording, you can proceed to enhance the script directly.

Apart from the regular functionality (transaction, rendezvous, parameterization, and etc…), there is also a new function to help you to evaluate a JavaScript or DOM objects if desired. The function, web_eval_java_script has three usages:

  • To evaluate JavaScript
  • To evaluate the DOM object Expression and save the value
  • To dump JavaScript properties of the window object

This function is never recorded. You can add it to your script to handle situations for which there is no standard solution.

For cache simulation, there is a new feature that allows you to fully simulate disk caching. You will use the web_dump_cache and web_load_cache function to accomplish the task. The idea is to capture the browser cache once, while running the script manually. Then the same cache can be used repeatedly in tests. Using Vuser persistent caching improves CPU usage on the application and database servers.

Tips and Tricks

1. Recording a script will fail if the machine is not restarted after installation or if an error occurs while restarting

2. Dynamic link texts (e.g., web_text_link(…, “Text=J Novak” , …) when “J Novak” is the first name in a search in a data base ) are not supported – Need to manually use Ordinal instead or use web_reg_save_param to do correlation.

3. To iterate the script, recording of an Action section needs to end at the same point it starts

4. While recording use only

  1. Elements inside the browser (‘Favorites’ and ‘home’ buttons are not supported)
  2. Direct navigation using the address bar

5. JavaScript alert (Pop-up window) is not considered an error as it might be informational. If needed, you can add a ContentCheck rule in the Run-Time Settings. You can see the alert message in the execution log and also the Run-Time Browser.

You can add verifications with web_eval_java_script().

Appendix

How to regenerate the script after recording

If needed, you can always regenerate the script after recording if the script is generated using the multiple protocol recorder. To regenerate the script,

1. Go to Tools à Regenerate Vusers.

2. Click on "Options" to set the option (you can change it if you want), and click <OK> to save the option.

3. Click <OK> to regenerate the script.

Note: You can regenerate the script to the regular HTML or URL mode if desired.

Steps to enable disk caching

The following function will help to enable disk caching. This is an optional step which allows you to Save the Vuser cache to a file. You will need to first dump the information to a cache file using web_dump_cache. During replay, each Vuser calls this information using web_load_cache functions. Here are the steps:

1. Insert the web_dump_cache function at the beginning of your script. This function creates a cache file in the location specified in the FileName argument.

Example:

To create a cache file in C:temp for each VuserName parameter:

web_dump_cache("paycheckcache","FileName=c:\temp\{VuserName}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:

Ku001paycheck.cache
Ku002paycheck.cache
Ku003paycheck.cache

2. Run the script at least once.

3. Insert the web_load_cache function into your script, before the Vuser actions. This function loads a cache file whose location is specified in the FileName argument.

Example: To load the file created on step1:

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

4. Comment out the web_dump_cache function.

5. Run and save the script.

Function reference and example for web_eval_java_script function

web_eval_java_script function has three usages, each with a different syntax. Do not mix arguments between syntaxes:

Purpose Function
To evaluate JavaScript Syntax:

int web_eval_java_script ( const char *stepName, const char *script, [DESCRIPTION, const char *arg1, …, const char *argn,] LAST );

The second argument, script, is the JavaScript expression to be evaluated.

Example:

The following will run the script method, document.getElementByID.

web_eval_java_script("Get My ID",

"Script=document.getElementById(‘MyID’).innerText = ‘MyText’;",

LAST);

To evaluate the DOM object Expression and save the value Syntax:

int web_eval_java_script ( const char *stepName, const char *Expression, const char *SaveExpressionResult, [DESCRIPTION, const char *arg1, …, const char *argn,] LAST );

The second argument, Expression, is the DOM expression to be evaluated. Upon execution, it will evaluate the DOM object Expression and places the DOM object’s printable value in SaveExpressionResult. Non-printable values such as "Object"/"void"/"NULL"/"Array" will return the value name.

Example:

The following will get the document title and stores it in a parameter.

web_eval_java_script("Get Title",

"Expression=top.document.title",

"SaveExpressionResult=prm",

LAST);

lr_output_message(lr_eval_string("{prm}"));

To dump JavaScript properties of the window object Syntax:

int web_eval_java_script ( const char *stepName, const char * PrintProperties, [DESCRIPTION, const char *arg1, …, const char *argn,] LAST );

The second argument, PrintProperties, is used to dump the JavaScript properties of the window object. Enter the argument: "PrintProperties=True"

Example:

The following will print the JavaScript property.

web_eval_java_script("Print data",

"PrintProperties=True ",

LAST);

GUI-Level Vuser Functions

Refer to the function help references for additional information about these functions

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s