Recording the Trade3 script

With the Script Modeler you can record and/or develop and refine your scripts. They form the content of your tests and let you generate the desired Web activity during a load test. They are stored in the repository from where they can be included into multiple tests. Perform these steps to record a new script:

1. Create a new, empty script by selecting File -> New Script -> HTTP, or by right-clicking the scripts node in the repository tree window and selecting New Script -> HTTP from the pop-up menu. Enter the name Trade3Scenario.

2. Launch the Script Modeler by double-clicking the previously created script.

3. Select Options -> Browsers and select the browser you want to capture with.

4. Select Capture -> Record or alternatively click the record icon (the red circle) in the toolbar to start recording. The settings that allow automatic cookie handling are enabled by default. For more information on recording options refer to the online help.

Note OpenSTA provides a proxy gateway that intercepts all HTTP traffic during recording. Script Modeler will automatically configure your browser's proxy setting to point to that gateway, and reset it to the previous values after recording. By default the proxy gateway uses port 81 on the local host.

5. After the browser window has launched, open the URL:

http://<host_name>/trade/scenario

In our case:

http://www.itso.ibm.com/trade/scenario

Do not reload the page, as we only want to capture exactly one request. When the page has loaded completely, either close the browser window, or switch back to the Script Modeler and select Capture -> Stop from the menu; both will terminate your recording session.

Tip: To navigate to a specific page on your site first, switch back to the Script Modeler window and press the Pause button in the toolbar. This will temporarily stop recording. When you have navigated to the link you want to start your script with, press the Pause button again to resume recording.

6. Save your script and exit Script Modeler.

You have now created a simple user session in the Trade3 application. An extract from that script is shown in Example 19-1. You can now view, replay and modify the recorded script inside Script Modeler. In case you change the script manually use the compile icon on the toolbar to find syntax errors.

Example 19-1 An excerpt of the recorded OpenSTA script "Trade3Scenario"

Start Timer T_TRADE3SCENARIO

PRIMARY GET URI "http://www.itso.ibm.com/trade/scenario HTTP/1.1" ON 1	&
	HEADER DEFAULT_HEADERS	&
	,WITH {"Accept: */*",	&
		"Accept-Language: en-us", &
		"Connection: Keep-Alive"}

Load Response_Info Header on 1		&
	Into cookie_1_0	&
	,WITH "Set-Cookie,JSESSIONID"

WAIT 6800

	!Cookie : JSESSIONID=0001lbubQp5N91qYmlb8KyynR58:v4fh5hfu 
	GET URI "http://www.itso.ibm.com/trade/style.css HTTP/1.1" ON 2	   &
		HEADER DEFAULT_HEADERS			&
		,WITH {"Accept: */*",			&
			"Referer: http://www.itso.ibm.com/trade/scenario", &
			"Accept-Language: en-us",			&
			"Connection: Keep-Alive",			&
			"Cookie: "+cookie_1_0}

	DISCONNECT FROM 1
	DISCONNECT FROM 2
	SYNCHRONIZE REQUESTS
End Timer T_TRADE3SCENARIO

  Prev | Home | Next

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.