Wednesday, October 3, 2012

JMeter - Basic Jmeter Setup To Test Single Web Page



Dear Friends,

This is my first blog and i decided to write this because i find lot of difficulties in  using Jmeter for load testing. Here i am going to write basic jmeter testing steps in windows for single page to load.


STEPS:


  1. Download  2.5.1.zip file from :    http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi
  2. Extract zip file and run exe file present in path: C:\Users\Downloads\jakarta-jmeter-2.4.zip\jakarta-jmeter-2.4\bin
  3. Run exe file and Jmeter UI will get appear with Test plan and workbench.                                      Note:Test Plan - Only one test plan exist per jmeter instance                                                        Note:Workbench - Used for temporary work and not used if we are testing a single web page.
     4.  Add :Test Plan > Add > Thread Group  [Thread group indicates no. of user]
          Thread Group > Add > Listener >Result Tree [To see response of one request]
          Thread Group > Add > Listener >Summary report [To see aggregate report]              
     5.  Add: Thread Group > Add > Config Element > Http Request  Default                                        
          Here add website homepage name in "Server Name/IP fields" i.e add "www.google.com" and leave
          "path" fileds blank. Refer Fig 5.1

    Fig 5.1 - http request sampler
    Fig 6.1 - Response code 200



    6.   Add:  Thread Group > Add >Sampler > Http Request                                                                     Here change the "Name"  as "Home Page" just to show this is for homepage and leave Server/IP and path fields as blank as we have already added default value in config file.                      

    7.   Add:  Thread Group > Add >Sampler > Http request                                                                      Here change Name fields as "Product page" i.e any internal page of website and leave server/IP name as blank as we have already defined in config file and set path of page as "/product_page.php".      
                                                                                                                                                                Note: Sampler used to send request to web server and to receive request from web server and as we are using Http request here hence adding http request sampler.

    8.  In Thread Group:
      Users: 50
      Ramp Up per : 10
      Loop Count:1
      It show that user/sec i.e.  50/10 =5 user/sec are hitting website and continue till 10sec with this rate. hence 5user/sec * 10 =50 user.

      9.  Now go to Run > Start or Cntrl+R
      Note: As we are testing only single page so no need to add  Workbench >Add >Non Test Element >Http Proxy server . This is required when recording no. of page in sequence. And here no need to set mozilla/browser proxy to localhost etc....etc.

      10.Also add "Gaussian Random Timer",  Thread Group > Timer > Gaussian Timer
      Deviation= 1000 ms
      Constant Delay = 3000 ms

      11. To re run test with different thread group just clear result using Cntrl+E


      Basic funda to understand what is Jmeter:





      Now will see aggregate report:
      • Samples: [count]It shows no of user we are executing i.e 50 user in our case.
      • Average: [mili sec]: This is actual parameter which tells about performance of web page. eg 300 shows for 50 user average time taken to get page loads is 300ms.
      • Min and Max:[msec] :This is min/max time taken for page to get load.
      • Std. Dev: [] This shows how many exceptional cases were found which were deviating from the average value of the receiving time.   The lesser this value more consistent the time pattern is assumed. Standard deviation is measured in same unit as average i.e in ms in this case. Std deviation shd be ideally zero.
      • Error %: This value indicated the percentage of error.  In our case 50 calls were made and all are received successfully this means 0 error.  If there are any calls not received properly they are counted  as errors and the percentage of error occurrence against the actual calls made is displayed in this value. System breakeven can also be calculated from error%. If after some point error % increase drastically means all request get bounced from web server.
      • Throughput: [request/sec]: Ideal graph of through put is increases gradually and become stable got long time. And as througput becomes low drastically that point is breakeven point.It shd be ideally high.It increases as load increases for some time and then become constant and after that degards as load further increases.
      So to test a page look for
      Average[shd be 0]
      Error% [shd be 0]
      Throughput request/sec : [shd increase initially and then stable at one point and come down again]
      Std Deviation:[msec] [shd be 0]

      Thanks
      Sheetal Singh












        No comments:

        Post a Comment