Web Load Tools - Using OpenSTA
Author: Bill Ricardi
OpenSTA is a powerful load testing utility. It is also shockingly easy to use once you know the little tricks and shortcuts. I'm going to show you how to use OpenSTA on a non-standard browser (Opera in this case), so that you can be prepared to use it in future load tests.
The software and documentation that you'll need if you want to follow along:
OpenSTA - http://sourceforge.net/projects/opensta/files/ostaw32/1.4.4/ostaw32-x86-1404.msi/download
Opera - http://www.opera.com/
The OpenSTA User's Guide - http://opensta.org/docs/ug/
Now we'll go through, step by step, and show you how to record a basic script that you can modify and experiment with later.
1) Launch Opera, OpenSTA NameServer, and then launch OpenSTA Commander. These are the three programs that you need running to create your first script.
2) Go to File (or Right-Click on Scripts) and then select New Script – HTTP
3) Name the script whatever you like, then double click it. This should launch the OpenSTA Script Modeler.

4) Within the Modeler, go to Options – Gateway and select the following options: Remote. Admin Port 3000/ Port 81. Auto Cookie Generation. Click OK. This should prepare you for settings that Opera will like.

5) In Opera, go to Tools – Preferences. Then Advanced – Network – Proxy Servers. This should bring up the proxy settings so that you can match them up to the OpenSTA Modeler settings.


6) Set the first four proxy settings to 127.0.0.1 (localhost) and port 81. Click OK. This syncs up Opera to the script recorder. The same settings should work in any browser.

7) In the OpenSTA Script Modeler select Capture – Record. Then go to Opera and record your scripted session. When you're done, go to Capture – Stop and answer Yes to the pop up. This will record the session and produce a script that you can edit.


8) Examine the script and edit as needed. Here is an example of what the script might look like:
!Browser:IE5
!Date : 12/03/2010
Environment
Description ""
Mode HTTP
Wait UNIT MILLISECONDS
Definitions
! Standard Defines
Include "RESPONSE_CODES.INC"
Include "GLOBAL_VARIABLES.INC"
CHARACTER*512 USER_AGENT
Integer USE_PAGE_TIMERS
CHARACTER*256 MESSAGE
Timer T_NEWSCRIPT
CONSTANT DEFAULT_HEADERS = "Host: 192.168.1.4:65428^J"
-SNIP COOKIE INFO -
Code
!Read in the default browser user agent field
Entry[USER_AGENT,USE_PAGE_TIMERS]
Start Timer T_NEWSCRIPT
PRIMARY GET URI "http://192.168.1.4:65428/upnp_descriptor_0 HTTP/1.0" ON 1 &
HEADER DEFAULT_HEADERS &
,WITH {"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, " &
"image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1", &
"Accept-Language: en-GB,en;q=0.9", &
"Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1", &
"Connection: Keep-Alive"}
DISCONNECT FROM 1
WAIT 3422
PRIMARY GET URI &
"http://sitecheck2.opera.com/?host=www.google.com&hdn=AGZGLiBzId7nGTYe3dx... HTTP/1.0" ON 2 &
HEADER DEFAULT_HEADERS &
,WITH {"Host: sitecheck2.opera.com", &
"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, " &
"image/gif, image/x-xbitmap, */*;q=0.1", &
"Accept-Language: en-GB,en;q=0.9", &
"Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1", &
"Cookie: "+S_cookie_2_0+"; "+S_cookie_2_1, &
"Cookie2: $Version=1", &
"Connection: Keep-Alive"}
PRIMARY GET URI "http://www.google.com/ HTTP/1.0" ON 3 &
HEADER DEFAULT_HEADERS &
,WITH {"Host: www.google.com", &
"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, " &
"image/gif, image/x-xbitmap, */*;q=0.1", &
"Accept-Language: en-GB,en;q=0.9", &
"Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1", &
"Cookie: "+S_cookie_3_0+"; "+S_cookie_3_1+"; "+S_cookie_3_2+"; "+S_cookie_3_3, &
"Cookie2: $Version=1", &
"Connection: Keep-Alive"}
-SNIP A LOT MORE-
DISCONNECT FROM 4
DISCONNECT FROM 5
ERR_LABEL:
If (MESSAGE <> "") Then
Report MESSAGE
Endif
Exit
9) Save your script for execution at test time. That's the bulk of how to create your first automated script. Check out the OpenSTA documentation for a LOT more information on script editing and execution.
This should give you some idea of how these programs work. They use a Proxy to capture the stream being sent to and from your browser, and then they translate that stream into a script that you can work with. When you execute it, that script is injected into the network stream, so you aren't burdened with the front end lag associated with actually performing the tasks, but the target server gets the full workout! That's about it.
