Jmeter for Performance Testing

   DevOps

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

JMeter

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.

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.

Http Test Script Recorder

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.

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.


This website uses cookies

These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience, and for analytics and metrics about our visitors both on this website and other media. To find out more about the cookies we use, see our Privacy Policy.

Please consent to the use of cookies before continuing to browse our site.

Like What You See?

Got any questions?


>