Skip to content

Load Testing Blog

JMeter response assertion

When running a protocol based load test with JMeter, it is always a challenge to make sure the server responses are correct. The default validation is only done on HTTP response codes based on their value:

OK < 400 <= KO

And since 4XX and 5XX HTTP response codes are error messages it makes sense. But it's easy to understand why this is not enough.

How to Find a Business Idea

Before revealing the secrets behind every successful business idea to you, let's first dive into the story of some of the most successful business men who bootstraped their companies.

Philip Knight (Nike)

Philip Knight, originating from Oregon, is a runner. He deeply embraces this sport since he is young. Running six miles a day, he enjoys the relaxation you feel when completing a new milestone. The endorphins build up in your body, giving you this joyful sensation of being completely relaxed and safe. Philip is the creator of Nike, one of the most successful sports shoe (and now sportswear) company.

Philip is a shoe dog: someone who is literally obsessed by shoes. His coach Bowerman, who cofounded Nike, formerly Blue Ribbon, with him is also a shoe dog. Bowerman likes to spend countless hours designing and improving existing shoes to improve his runners performances. As Philip is a runner, and Bowerman a runner coach, both are deeply connected to the runners world. They know the pain it can be to run with inappropriate shoes.

Philip later went to Japan, after backpacking around the world for more than a year, to visit a Japanese factory located in Onitsuka. He discovered there, in Kobe, one of the most advanced japanese running shoe, named the Tiger. He decides to talk to the factory owner about importing those shoes to the United-States. Nike is now a 30 billion dollars business.

Do you see where we are heading to? Probably not yet, but you're already half on the way. Let's talk about smaller success story.

Multiple User Login Using JMeter

Problem

You want to simulate a realistic load test where every user is having a unique user session. You application may only accept one user login per account at a time. You want each concurrent user to pick a different login password.

It's way more realistic to simulate concurrent users using unique logins and passwords because it's closer to the real world load. It's a good practice to avoid using a single user login and password for all concurrent users. Typically, web servers create web sessions per account. Using a single account for multiple users can mess up things on server side pretty quickly.

Solution

JMeter provides a facility to manage login and password: CSV Dataset Config. By defining a CSV file containing all the login and password couples, JMeter can pick a line from the file on each user iteration and assign them into variables.

Fix JMeter SNI Issue

SNI is the acronym for Server Name Indication:

Server Name Indication (SNI) is an extension to the TLS computer networking protocol by which a client indicates which hostname it is attempting to connect to at the start of the handshaking process.

SNI extension may not work with legacy web-servers who doesn't support it. Fortunately, SNI extension can be disabled in JMeter. JMeter is a Java program. Java has enabled SNI support in Java 7. The issue is typically displayed in JMeter as an SSLHandshakeException, with message like handshake_failure or handshake alert: unrecognized_name.

JMeter uses HTTPClient to perform Http Requests. HttpClient uses the Java JDK SSL support mechanism. Therefore, disabling SNI support in the Java Virtual Machine will disable SNI in HttpClient.

How to Use JMeter While Controller

JMeter's While controller is best suited for advanced scripts which simulate realistic user behaviors. It allows to define a behavior which occurs on a certain condition. Designing realistic behaving users involves designing users whose behavior depends on the server responses, and act accordingly.

This post explores in details various JMeter While usages and explains them thoroughly.

While Controller