Sunday 19 June 2016

JMeter Overview


JMeter is an open source load / performance testing tool. It generates virtual user in the form of thread and hit the target server and record the response accordingly. Depending upon the recorded response we concluded the server performance in the form of response time, throughput etc. I'm trying to give an overview from the scratch:
  1. Download latest version JMeter according to your O/S from JMeter official site. http://jmeter.apache.org/download_jmeter.cgi
  2. Unzip it & go to go to bin directory.
  3. For windows open jmeter.bat file, for Linux open jmeter.sh file either from CUI or GUI.
  4. Now either record the script by using http(s) script recorder & proxy server or write the script manually
    • Scrip record by using http(s) script recorder & proxy server
      1. Open Test Plan & Add a Thread Group
      2. Right click on the Thread Group and add a recording controller: Add > Logic Controller > Recording Controller
      3. Next, select WorkBench and right click on it and add the recorder: Add -> Non-Test Elements -> HTTP(S) Test Script Recorder
      4. Configure HTTP(S) Test Script Recorder: Under Test plan content select the Target Controller as Test Plan > Thread Group > Recording Controller
      5. Click on Start Button on HTTP(S) Test Script Recorder page. That will generate a Root CA Certificate in your JMeter’s bin directory.
      6. Import this Root CA Certificate to required browser and also set browser’s proxy server to localhost with port 8080 ( Can be changed from Global settings -> Port field in script recorder page )
      7. Now open the browser and navigate it. JMeter will record accordingly. You should filter it smartly to run it further.
    • Manually script writing
      1. Open Test Plan and Add Thread Group under test plan. Here number of thread represent the total number of virtual user. Here ramps-up time represent the total time in which all the virtual user will hit the server. For example, thread group: 1000 & ramps-up: 100 i.e all 1000 user will hit the server within 100 seconds. Loop count represent how many times this thread group will continue.
      2. Add Sampler -> HTTP Request under thread group. If we use any URL repeatedly then we can add Config Element -> HTTP Request Defaults with base URL.
      3. We can use HTTP Cookie Manager / HTTP Cache Manager / HTTP Authentication Manager from Config Element option to maintain cookie / cache / authentication respectively.
    • Add listener accordingly
      1. View Results Tree : Capture all request & Response in details
      2. View Results in Table: capture some specific info and shows in tabular form.
      3. Summary Report: Shows an overall summary report.
      4. Graph Generator : install it using JMeter plugin ( Click Here ) and Configure it to use.
  5. Run the script either from graphically or by using command.
    • Initially run script graphically for single user to check script and then run script for load test according to required number of user. At the of running the script you may have face memory related issue and to avoid such issue & faster execution, you should set up Distributed Environment Link Here ) and also run it using command.
  6. Analyze the result from listener & make full report.

No comments:

Post a Comment