Google Search

Monday, October 14, 2013

Scripting Using Load Runner 8.1 Click And Script Protocol


1        Introduction:


The Web Click and Script protocol was introduced in VuGen 8.1. The major advantage of the Web Click and Script protocol is that it supports client side JavaScript during replay.  As a result, the need for correlation is reduced and hence scripting time is reduced .It introduces a GUI-level scripting API, and an extremely quick way to generate load testing scripts.

·         With Web (Click and Script) one will save scripting time. As it eliminates the need for correlation.
·          New API functions describe user actions on Web objects (button, text link etc.).
·          In tree view, the steps are grouped according to their pages.
·         Can create a Business Process Report (Microsoft Word format) summarizing the VuGen script.


2        Comparison between Web (http/html) and Web Click & Script protocols


Web(http/html)
Web(Click and Script)
Scan for Correlation is Enabled
Scan for Correlation is Disabled
Test Validation can be automated
Text Validation has to be done manual
Cannot regenerate into a web click and script protocol
Can regenerate into a Web(http/html) script and vice versa

3        Points to be remembered while scripting


  • Record only using IE 6.0 and above
  • Record on WinXP/2000/NT (does not supports Win2003)
  • Record mouse clicks rather than keyboard strokes
  • Always start recording on a new script. Do not record over an existing script.
  • Record against browsers opened by Vugen only
  • Wait until the page loads completely before going on to the next step of the business process.
  • Avoid using context menus i.e. menus which pop up when clicking an item in a GUI.
  • DO NOT reorder functions or move them from one section of the script to another.






4        Over view about the Web Click and Script Recording Technology


  • LR 8.1 uses the QTP Engine in order for recording
  • This Engine basically emulates the User action done on the browser by functions such as web_browser, web_image_link,Web_list etc

5         Recording Options:





GUI Level: VuGen records HTML actions as context sensitive mode. User actions are recorded as GUI functions E.g. web_text_link, web_edit_field etc.

HTTP /HTML Level: VuGen records the actions similar to the Web html protocol. User actions are recorded as request to the server E.G web_url, web_link etc. 



5.1       GUI Properties:


5.1.1        Advanced:




Record rendering: Checking this option will record the values of the rendering-related properties of DOM objects (e.g. offsetTop, Scroll top, Scroll width), so that they can be used during replay. This may result in to significantly decrease the replay speed. (This option is not checked by default)

Record `click' by mouse events:  Checking this option will record mouse clicks by capturing mouse events instead of capturing the click () method. This should be checked when the recorded application uses the DOM click () method, which may result in generating multiple script functions for the same user action. (This option is checked by default)



5.1.2        Web Event Configuration:



Changing the settings under this recording option will affect how sensitive VuGen is to capturing events when navigating a webpage. Which events on the webpage to be recorded or not is decided by the web event configuration.


 “Basic” Web Event configuration option is the fastest.  This setting should be used unless certain expected events are not captured.
Records:
  • Click events on standard web objects like buttons, image, radio buttons
  • Mouse over on images, image maps
  • Click events on objects with handler or behavior attached by customizing listening criteria

“Medium” Web Event configuration option
Records:
  • Basic level
  • Click events on the <Div>,<SPAN>, and <TD> html tag objects



“High” Web Event configuration option slows down the recording and could also result in some events being captured twice.  This setting should be used when events that are expected are not captured.
Records:
  • Basic
  • Highly sensitive to the user actions on the web page.
  • Mouse over, mouse down, double-click, and events which  have handles or behavior attached

Custom settings:

Is the option which allows one to select the html Objects and the type of events to be captured for those objects





6        Function Used by the Click and Script for GUI level actions:


Listed below are some important functions that are used in Click and Script method of scripting. The functions return LR_PASS (0) on success, LR_FAIL (1) on failure, or LR_NOT_FOUND (2) if the object was not found. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.


web_browser: This is used for navigating to a URL.

Syntax:

web_browser(stepname, ..., DESCRIPTION, description arguments, ACTION, action arguments, [VERIFICATION, verification arguments,] LAST);

web_edit_field : This is called when any data is entered into a textbox.

Syntax:

web_edit_field(stepname, ..., DESCRIPTION, description arguments, ACTION, action arguments, [VERIFICATION, verification arguments,] LAST);

web_list: This appears when we have to select an item from dropdown box.

Syntax:

web_list(stepname, ..., DESCRIPTION, description arguments, ACTION, action arguments, [VERIFICATION, verification arguments,] LAST);

web_button: This is called when we click any button on a page to perform any kind of submit or page navigation operation.

Syntax:

web_button(stepname, ..., DESCRIPTION, description arguments, ACTION, action arguments, [VERIFICATION, verification arguments,] LAST);

web_radio_group: This appears when we select any item from a radio button group by clicking on the radio button.

Syntax:

web_radio_group(stepname, ..., DESCRIPTION, description arguments, ACTION, action arguments, [VERIFICATION, verification arguments,] LAST);



7        API after Recording


Note: this is just a sample.

8        Regenerate of Web (Click and Script) into a Web (http/html) script and vice versa


Steps to convert the script from Web (Click and Script) into a Web (http/html) script vice versa

  1. Go to Tools Menu select Regenerate Script Sub menu.
  2. Click on the Options button of the displayed Regenerate Script dialog box.

                       


  1. Select HTML-based Script or URL-Based Script to convert the convert the script from Web (Click and Script) into a Web (http/html) script and Gui-Based Script to convert the Web (http/html) script to GUI script. Click OK

  1. Click OK on the Regenerate  Script dialog box



This is how the Web (http/html) script will be look like



9        Business Process Report


Once the final version of the script is ready, one can create a report that will describe business process. VuGen exports the script information to a Microsoft Word document. One can use a pre-designed template or one provided with VuGen, to create reports with summary information about ones test run. VuGen lets one to customize the contents of the report by indicating what type of information one want to include.

Steps for creating Business Process Report:

1.    Choose File > Create Business Process Report. The Business Process Report dialog box opens.


             



2.    Specify a title in the Report title box.
3.    Enter any remarks in the Comment box.
4.    Accept the default report location and file name, or browse for the desired path. The default location is that of the saved script, and the default report name is VuGen Script Business Process.doc

5.    Click Advanced to specify the report's content.

                       


You can select one or more of the following content options:

Table of Contents: A table of contents indicating the page number of all of the other content in the report. If you disabled an option, it will not appear in the table of contents.

Recording Summary: A summary of the recording session as it appears when you click the Recording Summary link in the Tasks list.

Transactions and Rendezvous list: List of all of the transactions that were defined in the script, and rendezvous.

Parameter list: A list of all the parameters that were defined for the script. This list corresponds to the parameters listed in the Parameter List dialog box (Vuser > Parameter List).

Snapshots: An actual snapshot of the recorded step, adjacent to the step name and description.

Step descriptions: A short description of each step listed in the Tree view.

Document Template: The path and file name of the template to use for the report. The default template is stored in the product's dat folder.

Note: if one wants to create a new template, it is recommended that one uses an existing template as a basis for the new one. This will ensure that the required bookmarks and styles are maintained within the new template.

6.    To generate the report, click OK.

10     Useful Facts


When to Check the Record rendering option?

Record rendering option accounts to decrease in the speed of recording so it’s obvious to be used wisely. Question arise when to check it.

1.    Most simple option can be after recording if the replay fails and you find that object is not displayed in the replay browser of LR.

This option is not fully reliable as there can be some other cause for the failure.

2.    If there is table in the application on which some action is performed in the workflow, then the record rendering option needs to check.
3.    After recording if the application fails since it could not find a object and the object is not displayed in the replay browser, replay the script again with the RunTime Settings as below

                    Log > Extended Log > Check all the three options below

In the Replay log search for the “Layout entry” statement just before the failure step and check if the returned value, if it’s NULL that means the object was not rendered and the recording has to be done using the Record rendering option checked, or else there will be some number returned then no need to check the record rendering option.

11     References


  1. Project Experience
  2. Load Runner Documentation



No comments:

Post a Comment