Jmeter for Performance Testing


August 4, 2015

We all agree how important functional automated testing is, however not many applications go through a complete round of performance testing. Here are some of the reasons why everyone should make Performance testing an integral part of their software development process.

    – Capacity Planning
    – Scalability & Stability
    – Average online shopper expects your site to load in 2 seconds
    – Consumers will not wait for more than 3 seconds fro a page to load
    – Revenues lost due to poor performing applications

There are a ton of tools and services that are available to meausre your application performance, but we will be talking about Jmeter and it’s concepts.

Why Jmeter?

    – Open Source – no licensing cost
    – Portable. Runs on any OS that supports Java
    – Easy to use (little or no Programming)
    – Very Large user community, easy to find answers to questions.
    – Can be integrated with any CI tool
    – Can be extended to fit your needs.
    – JSR232 support
    – Can be easily scaled to test large scale applications.

Steps for designing a succesful load test

  1. Record a transaction using the proxy
  2. Save the recorded session as a thread group
  3. Modify or update the samples to handle dynamic content
  4. Add other necessary config elements to the test plan.
  5. Setup duration and number of threads/Users to simulate
  6. Add listeners to view results

This will be a series of blog posts of various techniques on performance testing using jmeter. In this post I will walk you through how to get started and record your first script.

Installation

    – The only prerequisite is java, so make sure you have the most recent version of Java installed
    – Download the binaries from the apache Jmeter’s site (http://jmeter.apache.org/)
    – Extract the archive and extract to a folder
    – There are scripts in the bin folder which you can use to open the Jmeter UI
    – If you are using a Mac or Linux desktop you will need to make the jmeter.sh is executable (chmod +x jmeter.sh)
    – Running the jmeter.sh or the jmeter.bat file will open up the Jmeter GUI.

Recording

To record your first script right click on the workbench -> add -> Non Test Elements -> Http Test Script Recorder
There are various options to choose when you are recording a transaction. I feel the best option to chosse is “Store 1st Sampler”. This option helps us record just the first request and is more than sufficient to simulate the intended action. You can leave the rest of the options as is.

Click the Start button and your Jmeter Recorder is ready to start capturing http traffic. Now setup a browser to use port 8080 as a proxy. You can do that by going to your browser network settings and entering localhost:8080 for you proxy. Navigate to any application using that browser instance and you should see samplers being captured under the HTTP test script recorder

Thread Group

Add a new thread group under your Test Plan and drag and drop all the recorded samples to your newly created thread group.

This is just a very basic test. Feel free to click the Green arrow and run it but you will not see much as there are no listeners added. In the next post I will show you how to edit a thread group to handle dynamic content and also how to debug the scripts.


Bharath
Bharath Khambadkone loves to automate and break systems by writing automated functional and performance tests. His favourite test frameworks/tools are cucumber, watir-webdriver, selenium, and JMeter. When Bharath is away from the keyboard he loves to spend time with family, hit the links, and aspires to be a Champions Tour Player. During his time with Modus Create, Bharath was a Sr. QA/DevOps Engineer.

  • Dmitri T

    Great entry blog, thanks for sharing, will stay tuned.

    In my turn I recommend walking through The Ultimate JMeter Resource List which is a great collection of JMeter-related articles, videos, blogs, etc.


What We Do

We’ll work closely with your team to instill Lean practices for ideation, strategy, design and delivery — practices that are adaptable to every part of your business.

See what Modus can do for you.

LET'S GET STARTED

We're Hiring!

Join our awesome team of dedicated engineers.

Loading...

APPLY NOW