Open System Testing Architecture

TOC PREV NEXT INDEX



Recording a Script


Scripts form the content of an HTTP/S performance Test using OpenSTA. After you have planned a Test the next step is to develop its content by creating the Scripts you need.

Launch Script Modeler from Commander to create and model Scripts. Then incorporate the Scripts into your performance Tests.

Script creation involves:

Create a New Script Using Commander
  1. In Commander select File > New Script > HTTP.
    Or: In the Repository Window, right-click Scripts, and select New Script > HTTP.
    The Script appears in the Repository Window with a small crossed red circle over the Script icon , indicating that the file has no content. As soon as you open the Script and record a Web session, the icon changes to reflect this and appears .
  2. Name the new Script FINDBYNAME, from the Repository Window, then press Return.
    Note: Script names must be OpenSTA Datanames.
  3. After you have created an empty Script it appears in the Repository Window, Scripts folder.
    Double-click the new Script FINDBYNAME , to launch Script Modeler.

Script Modeler

Script Modeler supplies versatile Script creation and modeling functionality. Use the menu bar and right-click menu options to create and model Scripts.

After you create a Script or when you open one, it is displayed in the Script Pane on the left-hand side of the main window. It is represented using SCL code which enables you to model it using the menu options or directly by keying in the SCL commands you need.

The Query Results Pane is used to display Web site responses. HTML information is recorded during the same Web session as the corresponding Script and is directly related to it, which enables additional modeling options.

The Output Pane. Displays the results of Script compilation. Scripts need to be compiled after modeling to check the validity.

Script Modeler Interface Features

Planning your Script

Before recording a Script make sure you are familiar with the Web site you are going to test. Ensure that it is functioning correctly and that you understand its basic behavior.

Below is a summary of the demonstration Web site, Which US President?.

The Demo Web Site

Which US President? is a simple WAE that provides a variety of information concerning past presidents of the United States. The presidents are selected through a filtering search.

The application has five sections of interest:

Configuring Script Modeler for Script Creation

The next step is to set up the correct Script recording environment. This includes selecting the type of browser you want to use to record Scripts and ensuring that your browsers proxy server settings are correctly configured.

Script Modeler's recording mechanism makes use of a proxy server, known as the Gateway, which is used to intercept and record the HTTP/S traffic generated during a Web session. This recording mechanism involves temporarily adjusting the proxy server settings of the browser you use for the duration of the recording.

There is currently a limitation in this recording mechanism. If your browser gets its proxy configurations through any of the available automated mechanisms, Script Modeler cannot adjust your proxy server settings and correctly configure the Gateway. For the recording mechanism to work, the browser must either have no proxy server configured or have a manually supplied proxy server and port configured. If you are unsure if this is the case, or do not know how to configure your browser in this manner, talk to your system administrator.

Before you can create a Script you need to select the browser you want to use for the recording.

Select Browser Type for Script Recording
  1. Create a new Script using Commander.
  2. Open the Script from the Repository Window.
  3. In Script Modeler, select Options > Browser.
  4. In the Select Browser dialog box, click , and select the browser you want to use from the list, either Internet Explorer 4, Internet Explorer 5 or Netscape.
    Note: The Netscape option refers to Netscape Navigator version 4.7
  5. Click OK to save your settings.
    When you start recording using Script Modeler, the selected browser is launched automatically.

Recording a Web Session

After you have selected a browser and configured the Gateway, you are ready to record a Web session and create a Script.

When you begin recording a Web session use the browser as normal and move through the Web site performing the steps you want to record. In this example, the first step is to go to the login page of the demonstration Web site Which US President?, by typing in the URL of your locally installed copy.

Recording a Script
  1. After you have created an empty Script it appears in the Repository Window, Scripts folder.
    Double-click the new Script FINDBYNAME , to launch Script Modeler.
  2. Click the Record button , in the Capture/Replay Toolbar, or select
    Capture > Record, to begin the HTTP/S capture process.
    This action launches the Gateway and the Web browser you have selected.
    Your browser's Home page Internet option is overridden by Script Modeler when you start recording. The setting is replaced with about:blank, which specifies that your home page will be a blank HTML page. This ensures that your normal Home page is not launched and recorded in the Script.
  3. Type in a URL of the demonstration Web site Which US President?, and hit Return.
    The browser displays the Log-in page of the Web site which requires you to enter a log-in name and password. The Password is the reverse of the Log-in so you can use the same single character in both text boxes.
  4. Type A in the Log-in and Password text boxes.
  5. Click the login button.
    The Web site displays a page which enables you to search through a simple database comprising a list of past US presidents and some of their personal details including political party and religion.
  6. In the Presidents Name text box, type in part of a president's name, for example Truman.
  7. Click the Submit Query button.
    The Web site displays a combined search and results page which displays a single entry for Harry S Truman.
  8. After you have completed your search you need to Log-out.
    Click the LOG OUT link in the top right-hand side of the page.
  9. After you have completed the browser session, either close the browser window to end the recording, or switch back to Script Modeler and click the Stop button , in the Capture/Replay Toolbar.
    When you have finished recording the Script the SCL formatted data is displayed in the Script Pane as illustrated below:
    The Script represents the data it contains using syntax coloring to help identify the different elements. For example, SCL keywords and commands are represented in blue. A Script is divided into three sections represented by the following SCL keywords; Environment, Definitions and Code.
    The Environment Section
    The Environment section is always the first part of a Script. It is introduced by the mandatory Environment keyword. It is preceded by comments written by the Gateway which note the browser used and the creation date. This section is used to define the global attributes of the Script including a Description, if you choose to add one, the Mode and Wait units.
    The Definitions Section
    The Definitions section follows the Environment section and is introduced by the mandatory Definitions keyword. It contains all the definitions used in the Script, including definitions of variables and constants, as well as declarations of timers and file definitions.
    It also contains the global_variables.INC file which is used to hold variable definitions of global and Script scope which are shared by Virtual Users during a Test-run, and the Response_Codes.INC, an include file which contains the definitions of constants which correspond to HTTP/S response codes.
    The Code Section
    The Code section follows the Definitions section and is introduced by the mandatory Code keyword. It contains commands that represent the Web-activity you have recorded and define the Script's behavior. The Code section is composed of SCL commands that control the behavior of the Script.
  10. Before you save your new Script you need to compile it using the Syntax Check option to ensure the validity of the recording.
    Select Capture > Syntax Check or click , in the Capture/Replay Toolbar. Compilation results are reported in the Output Pane. If compilation is unsuccessful, you may need to re-record the Script or model the contents to resolve the problem.
    Note: You can record over the top of an existing Script until you achieve the content you need.
  11. After compilation replay the Script to check the activity you have recorded.
    Select Capture > Replay or click , in the Capture/Replay Toolbar
  12. When you have finished recording, click , in the Standard Toolbar to save your Script in the Repository, or click File > Save.
  13. Select File > Close to close the current Script or File > Exit to exit Script Modeler.
    Note: If you have unsaved Scripts open in Script Modeler, you are automatically prompted to save them before the program closes. Closing down Script Modeler also closes the browser which restores your original browser settings.

Query Results Pane

After you have finished recording you can also view the HTML information recorded at the same time as the Script. You can access this data by opening a Script in Script Modeler then selecting a URL you want to view from the URL Address Bar and clicking the URL Details button , in the Standard Toolbar. HTML information is organized into five categories:

Before you exit from Script Modeler make sure you have saved your Script then select File > Exit to exit Script Modeler.

Next...

Now you have created a Script you are ready to model it.

Modeling a Script is not an essential procedure but it can be useful to modify Scripts using variables for example, to better simulate the activity of real Web users when a Test is run.

Next Section: Modeling a Script

Back to Contents


OpenSTA.org
Mailing Lists
Documentation feedback
TOC PREV NEXT INDEX