Monday, January 28, 2008

Recording a Test Plan - Quickly

Jmeter is simply to test the load. To test the first thing we need is a Test Plan. In Jmeter, creating a test plan is to record a test. Lemme explain myself. I start the (recording on) Jmeter and run through the steps which I have to perform for a specific test. Once I have recorded the steps that means I have told Jmeter what to do again and again with a loads of users. I have to run through the steps at least once to teach Jmeter how to do it. Jmeter is a quick learner [but still dumb]
Now lets run through the steps to be used to record a test. Jakarta has already created a tutorial on this and that could be found
here in PDF format.
1. Start Jmeter
2. Right click (cmd-click) on the “test plan” and add a new thread group: add -> thread group



3. Right click (cmd-click) on Thread Group and select "add -> config element -> Http Request Defaults"


 
4. Server name – enter “jakarta.apache.org”
5. Port number – enter “80”
6. Protocol – enter “HTTP”



7.Right click (cmd-click) on workbench and add the Http proxy: add -> non-test elements -> Http
Proxy Server



8. Port field - Enter “8080” [Rest is not necessary for now]



Though this much information is enough for Jmeter to run a site, but you'll reach no where with this. So we have to add some listeners to read the response.

9. Right click on Thread Group and select "add -> listener -> View Results Tree"


Now comes the crucial part: making Proxy Server. In simple language, what we need now is to make our explorer to request Jmeter with each and every action. The Proxy thus created will be helpful in scanning the outcome of the steps we perform on the explorer. You don't understand? No worries :) lets follow the following steps everything will be clear. I am using a Mozilla Firefox explorer. Same could be done on IE or Safari or any other explorer out there.

10. On Firefox, Go to Tools > Options [ or Firefox > Preferences, on Mac]
11. Click on 'Advanced' tab and then on 'Network' sub-tab in Options



12. Click on Settings button
13. Select 'Manual Proxy Configuration' radio button
14. HTTP Proxy: localhost
15. Port: 8080 [This should be same as the one put in Port filed under WorkBench > HTTP Proxy server in Jmeter settings]


Phew! all the settings part is over now. Now lets teach Jmeter a lesson :)
16. On Jmeter select "WorkBench > HTTP Proxy Server"
17. Click on 'Start'
18. On Firefox (or the browser for which the Proxy has been set) enter http://jakarta.apache.org/jmeter/index.html in the address bar.
19. Click on few links here and there

Notice that some information is being added, automatically, to the left hand Panel of Jmeter



20. On Jmeter, click 'Stop'

This is it, Bingo! we have just recorded a Test. But What is the use of it? The answer will be in my next post... till then enjoy created test plans. There are many ways to do the same thing on Jmeter. Some of these are as below:
1.
Test Your Web Application's Performance | Yet another Tech Blog
2.
Load Testing with Apache JMeter
3.
Load Testing your Applications with Apache JMeter

No comments: