Creating Scripts
- Script Development
- The Script Development Process
- The Gateway and Script Creation
- The Script Recording Process
- Script Modeler Configuration Options
- Creating New Scripts
Script Development
After you have planned your performance Test structure, you need to develop the Test contents by recording the Scripts that will be included in your Tests. Launch Script Modeler from Commander to record and model Scripts, then incorporate them into your Tests using Commander.
Scripts are HTTP/S recordings of the Web sessions you conduct using Script Modeler which represent the HTTP/S traffic they record as SCL code. The browser requests recorded are automatically encoded using SCL during the capture process. This gives the HTTP/S data an intelligible structure and makes it possible to model the Script. Script Modeler's editing capabilities enable you to record and edit Scripts to simulate the behavior of thousands of virtual users when a Test is run.
Scripts form the content of your Tests and enable you to generate the Web activity you want during a Test-run. They are stored in the Repository, which is displayed in the Commander Main Window. From here they can be selected for inclusion by reference in multiple Tests.
When you run a Test, the Scripts that it incorporates are run according to the Task Group settings you have specified in Commander. These settings determine the load directed against the target WAE when a Test is run. Scripts encapsulate the Web activity you need to reproduce and the Task Group settings control the way the Scripts are run. Together, these elements control the type of the test environment that is simulated when a Test is run.
Before you begin to record your Scripts you should check your recording configuration. There are several options to choose from depending on the software setup you have on your computer and the network configuration you are working within. You can select the type of browser you want to use to record your Scripts, as well as the method of connecting to the target WAE.
See also:
The Script Development Process
The Script Development Process
The Script development process typically includes the following procedures:
Configuring Script Modeler for Script Recording
- Check Your LAN Proxy Server Settings
- Set Your Proxy Server Settings for a Dial Up Connection
- Select Browser Type for Script Recording
- Select the Gateway's Local Recording Mode
- Select the Gateway's Remote Recording Mode
- Select Automatic Cookie Modeling
- View Gateway HTTP/S Traffic During Script Recording
Script Recording
- Create a New Script
- Create Additional Scripts
- Save a Script
- Close a Script
- Rename a Script
- Delete a Script
See also:
The Gateway and Script Creation
The Gateway and Script Creation
Script Modeler enables you to create Scripts by rerouting the HTTP/S traffic that passes between a browser and WAEs, through the Gateway and recording the data it intercepts. The Gateway achieves this by temporarily overriding the Local Area Network (LAN), settings specified in your browser when you begin recording a Script. The browser's proxy server settings are temporarily modified in order to force it to use a proxy server when the browser is launched. This override directs the browser's internet connection through the Gateway which functions as the specified proxy server.
The Gateway listens for browser requests then forwards them to the target WAE, or to another proxy server if your browser normally has one defined, and then on to the WAE. When you start recording a Script, your Web browser is launched and the Gateway records the HTTP/S requests along with the WAEs responses to your browser.
The home page, address settings of your browser are also temporarily altered by the Gateway during Script recording. This removes all reference to the home page URL from the Script, since it is unlikely to form a part of the Script you create. Enter a URL in the Address text box to launch the WAE of your choice. When you have completed your recordings the original browser settings are restored.
See also:
Local Area Network Settings
The Local Area Network (LAN) settings for your browser are temporarily modified by Script Modeler, when you begin recording a Script and for the duration of the recording session. Script Modeler forces your browser to use a proxy sever in order to re-route HTTP/S traffic through the Gateway where it is recorded. The configuration of any existing proxy server settings you may have, are unaffected by this temporary alteration of your browser settings. So browser requests are correctly forwarded from the Gateway to the WAE. Your browser's original proxy settings are restored after the capture process is complete.
The Gateway has two recording modes, local and remote. In local mode the internet connection settings are overridden as described above. Whereas in remote recording mode you need to modify the proxy settings of the remote browser manually in order to use the proxy Gateway.
See also:
Check Your LAN Proxy Server Settings
Check Your LAN Proxy Server Settings
- Select Tools > Internet Options > Connections > LAN Settings.
- The screen shot below shows the proxy server settings for a Local Area Network connection in Internet Explorer 5:
- Note: Script Modeler cannot establish an internet connection if the Proxy server settings include Automatically detect settings or Use automatic configuration script.
- To overcome this difficulty you can either disable the use of all proxy severs or manually enter the name and port of the proxy sever. You may need to see your system administrator for this information.
- Note: The Address and Port details will vary according to your network configuration and the Internet Service Provider you use.
Using a Dial Up Connection
A dial up internet connection setup involves establishing a connection within Script Modeler when you begin an HTTP/S recording and the browser is launched. As well as entering your dial up settings, including user name and password, you must manually change the proxy server settings. Script Modeler only automates the configuration of the proxy server settings for a LAN connection. You need to select to use a proxy server to direct your internet connection through the Gateway.
See also:
Set Your Proxy Server Settings for a Dial Up Connection
Set Your Proxy Server Settings for a Dial Up Connection
- Select Tools > Internet Options > Connections > Settings.
- In the Settings dialog box, click the Use a proxy server check box, enter the Address (your computer name) and Port details (port no. 81).
- Enter your details as usual, then click OK to connect.
The Script Recording Process
Script Modeler creates a Script exactly as the browser requested the Web pages and their contents. They are created by the Gateway and consist of SCL code, including GET, POST and HEAD commands, which represent corresponding HTTP/S instructions.
Scripts represent HTTP/S browser requests in SCL code and are saved in a .HTP file. During the same recording session the corresponding WAE responses are recorded by the Gateway in a .ALL file. This includes DOM, HTML and Web page structure data. The full detail of a Web session is stored in these two files.
After you have clicked the Record button in the Capture/Replay Toolbar and entered the first URL in your browser's Address text box, the WAE responds by sending the HTTP/S data that forms the content of the Web page displayed by your browser.
Loading a Web page involves parsing or compiling the Web page structure from the raw HTTP/S data returned by the WAE in response to the URL or PRIMARY GET. The content is then rendered on screen by the browser whilst concurrently making additional, asynchronous requests on other TCP connections via secondary GETs for the remaining contents of the Web page. The browser continues to issue requests and render any remaining content until the Web page is fully loaded. The Gateway records and formats this information.
The Script Modeler HTTP/S capture process is illustrated below:
Browser requests hit the target WAE via the Gateway, across the Internet or other network. Browser requests are recorded by the Gateway as a Script (.HTP file). WAE responses are recorded by the Gateway in a .ALL file.
Note: OpenSTA Console refers to a computer which has an installation of OpenSTA. This includes the OpenSTA Architecture and Commander and it may also include the Repository, where all Test related files and results are stored. The PC will also have a Web browser installed and is typically the home for the Gateway. In this diagram the Gateway is shown as separated from the OpenSTA Console to clarify the Script recording process.
See also:
Script Modeler Configuration Options
Script Modeler Configuration Options
Before you capture a new Script there are some configuration options available within Script Modeler that you may want to check or change. Some of these options relate to the type of Web browser(s) you have installed on your computer, the settings you have specified for them and the Gateway recording mode you want to use, either Local or Remote.
Other configuration options available relate to Gateway settings that can assist you during the recording process and afterwards if you need to model your Script.
You can opt to display a command line console which displays the activity of the Gateway during recordings and to trace this activity.
Another Gateway setting allows the automatic generation of variables to replace any cookies received during a Web session. Automating the substitution of a variable for the unique identity of the original cookie transmitted helps to simplify modeling and speed up the development of your Tests.
Use the Options menu choices to configure your settings.
See also:
Configuring The Gateway: Local and Remote Recording
Browser Settings
If you have more than one type of browser installed on your computer, you can choose which one you want to launch in order to record your Scripts.
OpenSTA currently supports Internet Explorer 4 and 5, and Netscape Navigator 4.7, for use in HTTP/S captures. If you have several browsers installed on your computer you may want to specify which browser is launched when you begin recording a Script. If you have more than one of the browser types mentioned installed and you do not select one, Script Modeler defaults to the latest version of Internet Explorer installed on your computer.
See also:
Select Browser Type for Script Recording
Select Browser Type for Script Recording
- In Script Modeler, select Options > Browser.
- In the Select Browser dialog box, click , and select the browser you want from the list, either Internet Explorer 4, Internet Explorer 5 or Netscape.
- Click OK to save your settings.
Configuring The Gateway: Local and Remote Recording
You can choose to record Scripts on your own computer or through another remote computer by selecting the appropriate Gateway recording mode, either Local or Remote.
In local recording mode the browser you have selected to use is launched when you begin the HTTP/S capture process you are recording from. The default mode for capturing HTTP/S traffic through the Gateway is Local. In this mode the Gateway listens on port 81 for HTTP/S traffic by default.
If there is no browser installed, or if you want to use another computer to record your Scripts, you can choose the Remote recording mode. You can use any networked computer with a browser installed to conduct remote Script recording. If you use Remote recording mode you must manually modify the proxy server settings of the browser on the remote computer. Make a note of these settings because you need to copy them exactly into the Gateway settings on the computer from where you are recording.
See also:
Select the Gateway's Local Recording Mode
Select the Gateway's Remote Recording Mode
Select the Gateway's Local Recording Mode
Note: Local Recording Mode is the default setting.
- In Script Modeler, select Options > Gateway.
- In the Gateway dialog box Capture section, click Local.
- Type in an Administration Port and Port number if the defaults displayed here are in use. Otherwise accept the defaults displayed.
- Click OK to save your settings.
Select the Gateway's Remote Recording Mode
- In Script Modeler, select Options > Gateway.
- In the Gateway dialog box Capture section, click Remote.
- Type in an Administration Port and Port number if the defaults displayed here are in use. Otherwise accept the defaults displayed.
- In the Proxy section of the Gateway dialog box, the selections you make must reflect the settings specified in the Proxy settings dialog of the remote computer you are using, these settings include:
- Proxy Address and Port: Enter the address and port number of the proxy server you want to use to connect to the Internet.
- Secure and Port: Enter the address and port number of the secure proxy server you want to use to connect to the Internet.
- Bypass proxy server for local addresses: Check the box if you do not want to use the proxy server for all local addresses, including intranet addresses. Note: You might be able to gain access to local addresses easier and faster if you do not use the proxy server.
- Do not use proxy server addresses beginning with: Enter the Web addresses that do not need to be, or should not be, accessed through the Proxy server.
Gateway Settings
The Settings section of the Gateway dialog box offers you options which you can select to enhance the quality of the Scripts you record and improve the visibility of the recording process.
Select the Console option to display a command line window during the recording process. The console displays Gateway activity during the Web session.
Select the Automatic Cookie Generation option to automate the processing of any cookies you record in your Scripts. If the WAE you are testing generates cookies, then enabling this function can help to speed up the Test creation process. This option automatically substitutes the unique identities of any cookies received from a WAE with a variable. The automatic modeling of cookies is an optional feature but active by default.
Automatic Cookie Generation
Any cookies issued by a WAE under test are recorded in the Scripts you create. If cookies include unique session identity information such as a time stamp, the Scripts that contain them will be rejected by the target WAE when replayed during a Test-run unless they are modeled.
Modeling cookies is an essential procedure that enables Scripts to be used in Tests. It involves replacing the unique session identity encapsulated by a cookie from the original Web session and it is achieved by assigning the fixed values recorded to a variable. Script Modeler gives you the option to automate this task or to manually model Scripts depending on your requirements. The default setting in Script Modeler is for automatic cookie generation.
Selecting to automatically model cookies can help improve the efficiency of the Test development process. It also enables you to develop a modular Test structure by incorporating a sequence of Scripts in a Task Group to function as one browser session during a Test-run, without having to model the cookie information. For more information on developing a Task Group that combines multiple Scripts, see Developing a Modular Test Structure.
See also:
Select Automatic Cookie Modeling
View Gateway HTTP/S Traffic During Script Recording
Developing a Modular Test Structure
Select Automatic Cookie Modeling
View Gateway HTTP/S Traffic During Script Recording
- In Script Modeler, select Options > Gateway.
- Click the Console check box to view a Command Line window during the Script capture process.
Creating New Scripts
After you have configured the Gateway and chosen the Web browser you want to use for Script recording you are ready to begin the HTTP/S capture process.
Recording Scripts is straightforward.
In the Commander Menu Bar select File > New Script > HTTP, or right-click Scripts in the Repository Window and select New Script from the menu. Give the Script a name, press return and double-click the new Script icon in the Repository Window to launch Script Modeler.
Use the Capture/Replay Toolbar or the Capture menu option in Script Modeler to control the recording process.
After you have recorded a Script you can either save it or begin the next recording by selecting File > New. You can have several Scripts open at the same time if required so you can either save your Scripts as you record them or before you exit. Press Ctrl > Tab to switch between the Scripts you have open.
Two files are generated during a recording session and stored in the Repository after you save, a .HTP file, or Script, which records the Web browser requests, and a .ALL file which records the WAE responses and contains HTML data.
Script names must be defined according to the rules for OpenSTA Datanames, with the exception that the name can be up to 60 characters long.
After you have saved the Script it appears in Repository Window . The small crossed red circle is removed indicating that the Script is ready for use. Drag and drop the Scripts you need from the Repository Window into your Tests.
Note: If you want to create a Test that simulates a first time user and you have previously accessed the target WAE, make sure you clear the browser's memory cache before recording your Scripts. In Internet Explorer 5, temporary Internet files are removed by selecting Tools > Internet Options then clicking the Delete Files button.
See also:
Developing a Modular Test Structure
Capture/Replay Toolbar
The Capture/Replay Toolbar is used to control the Script recording process. It is located below the Menu Bar in the Script Modeler window. You can use it to record multiple Scripts during the same Web browser session
Click the Record button , in the Capture/Replay Toolbar to begin the HTTP/S capture process. This action launches your Web browser which in turn activates the Gateway, or Proxy Server. The HTTP/S traffic generated during the recording session is intercepted by the Gateway and the HTTP/S requests are encoded to produce a Script written in SCL. This data is displayed in the Script Pane after the recording process is complete. The HTML pages accessed during the Web session are recorded in a separate file and can be displayed in the Query Results Pane.
Use the Add Comment button , to add comments during a recording session. They are used to assist you when monitoring a single stepping session.
Use the Pause button to suspend Script recording. Click to resume recording.
When you have recorded everything you need, end your recording session by clicking the Stop button , or close down the browser.
Use the Syntax Check button to compile the current Script. The SCL compiler is launched and generates an object file called a .TOF file. This is the file that is executed by a Task Group Executer when a Test is run.
Use the Replay button to compile the current Script and replay it within Script Modeler to ensure that it is valid. Replay activity can be monitored using the Output Pane.
See also:
Create a New Script
- 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 .
- Give the new Script a name within the Repository Window, which must be an OpenSTA Dataname, with the exception that the name can be up to 60 characters long, then press Return.
- Double-click the new Script icon , to launch Script Modeler.
- 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.
- Note: The Gateway is launched in Local recording mode by default unless you have chosen Remote recording mode.
- Type in a URL and hit Return or select a URL from the browser's URL Address bar. Then use the browser as normal to perform the actions you want to record in your Script.
- Tip: Use the Add Comment button in the Capture/Replay Toolbar to add comments while you are recording a Web session, or select Capture > Insert Comments. They are used to assist you when monitoring a single stepping session. The time taken to add a comment is not recorded in the Script.
- After you have completed the browser actions you need, switch back to Script Modeler from the browser and click the Stop button , in the Capture/Replay Toolbar to end the recording. Or, close the browser.
- 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.- After compilation replay the Script to check the activity you have recorded.
Select Capture > Replay or click , in the Capture/Replay Toolbar- When you have finished recording, click , in the Standard Toolbar to save your Script in the Repository, or click File > Save.
- Select File > Close to close the current Script or File > Exit to exit Script Modeler.
See also:
Developing a Modular Test Structure
Create Additional Scripts
Once you have launched Script Modeler you can record additional Scripts.
- In Script Modeler, select File > New.
- Click the Record button , in the Capture/Replay Toolbar, or select Capture > Record, to begin the HTTP/S capture process.
- In the Script Name dialog box, give the new Script a name, which must be an OpenSTA Dataname, with the exception that the name can be up to 60 characters long.
- Click OK to launch the Gateway and the Web browser you have selected and begin recording. Create your Script as usual, see Create a New Script for details.
Save a Script
Close a Script
Rename a Script
- In Commander, double-click Scripts, in the Repository Window to expand the directory.
- Right-click the Script and select Rename, or double-click slowly on the Script.
- Enter the new name and press Return, to save your changes in the Repository.
- Note: When you rename a Script the Tests that reference it notify you that it is missing by highlighting the Task table cell it occupied in red when the Test is opened. The Test cannot run with a missing Task. Rename or recreate a Script to match the name of the missing Script to resolve this problem or delete the Task from the Test.
Delete a Script
- In Commander, double-click Scripts, in the Repository Window to expand the directory.
- Right-click on the Script and select Delete from the menu.
- Click Yes to confirm the deletion.
- Note: When you delete a Script, the Tests that reference it notify you that it is missing by highlighting the Task table cell it occupied in red when the Test is opened. The Test cannot run with a missing Task. Recreate a Script with the same name as the missing Script to resolve this problem or delete the Task from the Test.
- Note: Your changes are automatically saved in the Repository.
OpenSTA.org Mailing Lists Further enquiries Documentation feedback CYRANO.com |