Feb
12
2006
OpenSTA
Posted by admin under
Tools

Since it doesn't seem to be a secret anymore I might as well tell you - I am working on a PRO version of AdMentor ( the ASP.NET version ) and while I don't want to give yo any details about it yet, this article will instead describe one of my experiences I gained during development.
In short I needed to do some load testing. First of all I wanted to see that throughput is ok for each of the supported database engines, but a load test would also serve as as a unit test with respect to stats tracking.
I looked around for different tools to help me with this and download and tested a few, but for various reasons (money being one) I have now decided to use OpenSTA.
OpenSTA is a free and opensource project (available through Sourceforge) and while it looks pretty much like most load testing tools I'll try to guide you to how to perform your first test.
I should say right away, I am no expert of OpenSTA, I might even have misunderstood how to work with it most effectively, but this is how I did to get my very first - simple load test running:
1. Download of course.
2. When starting the application you might get some errors due to firewall
3. The GUI looks like this:
As you can see here I have created two tests, AdMentor and AdMentor10_Users.
Now the first thing you need to do is create a script. You then put the script into the test. CALLADMENTOR is a script.
Rightclick on "Scripts" and you get a menu, now select New script, Http. You get a new item in the tree:
Doubleclick on that script item (TEST) and you get the Script Modeler - which is a GUI tool to record and write scripts.
Now, in my eyes, this is the weak part of OpenSTA. As scripting language it uses something called SCL
As from the SCL FAQ: "It takes a form similar to, and inspired by Fortran." - might feel a little weird but it's not as hard as it sounds. The code is typically produced by making a recording in the Script Modeler, and you do some changes after that.
First it's good to change the Browser to whatever you are using - menu Options, Browser.
Then, and now we get back to the specific test case. I want to run some load tests on AdMentor and the call is like http://server/AdMentor4/admentorserve.ashx?type=_type&z=_zone&a=_adpos
Where _type could be either iframe, js or img. _zone should be one of the zoneid:s defined in the system and _adpos one of the adpositions.
So first I just record:
Internet Explorer starts and I browse to http://localhost/AdMentor4/admentorserve.ashx?type=img&z=3&a=3 I quit recording and now I have gotten a script produced for me in Script Modeler:
Save it and go back to the first GUI dialog. Now create a new test (rightclick Tests, New) - here I call it OURSAMPLE. Doubleclick on it.
Now we drag the script TEST into the right pane - drop it over Task 1 column:
Now, if we want to run this for 30 seconds, we select
Now we can run the test by clicking the green arrow. It takes a while to warm up, but soon the status changes to running and now just wait. After ot's done go to Results tab page:
You get a lot of result reports you can watch, I wont get into these.
That's it - the very first and easiest load test with OpenSTA. Now lets go back to scripting - we want the system to automatically alter the querystring parameters - randomly, i.e sometimes use type=js, type=img, type=iframe etc. As for the adpos and zone I took the easy wat, while it might be possible to retrieve those records from the database I just looked in database and found that I'm having
zoneid=3 and 4
adpos= 3 and 4
So, now get back to script modeler: This was not very intiutive, still it just took me some minuites reading the manual and docs

Adding some variables.

Randomizing values.

Changing the URL call to use the variables instead.

And here we are checking the results - and hey - it works - called with random data!