Top JMeter Interview Questions and Answers
We all know that even being open-source tool, which can be simply downloaded and installed and used and having so much features available for performance testing, JMeter has become very popular in very short time.
JMeter is considered to be best performance testing tool when it comes to using any tool in open source. It is a lightweight Java application that has been developed by Apache.
In this article, we are concentrating more on the concept of JMeter, in the form of JMeter interview questions and answers. It will help us to understand the prime concepts of the JMeter and also will help you to clear interview in JMeter performance testing profile.
Given below are some of the questions and answers in JMeter which we should learn by heart to gain confidence in the interview. Let us see one by one.
Q #1) Explain the architecture of JMeter.
Answer: We all know that JMeter is open source application which is built in Java and has been designed to do load and performance testing.
JMeter sends request to the appropriate server and also simulates number of users to create load on target server and depending upon the response given by the server for all the requests, it collects all the response from the server and present statistical report in the form of table and graph in JMeter graphical user interface.
Q #2) Does JMeter simulate actual browser behavior?
Answer: Answer is No. JMeter actually doesn’t behave exactly in the same manner as actual browser does.
Normal browsers render HTML web pages which we can see by going to Page Source of HTML web page but in JMeter it is not so. It doesn’t render HTML web page, although we can see HTML format but actually, it is not so.
Q #3) what is distributed testing?
Answer: Distributed Testing simply means that multiple machines should be used to generate heavy load on the target server.
Configuration is designed in such a way that one machine is master machine and other machines can be made as slave and all the machines should be used to generate load on the target.
It is important that all the machine whether it is slave or master, should be located within the same network or what we can say technically is that they should live within same Subnet Mask.
We do not need to understand what Subnet Mask is, at the moment .we just need to understand that it should be in same network and also we should be using same version of Java and JMeter as well.
Now, we should understand why we use multiple machines to create load on target server. Reason is that we can handle a limited number of threads (100- 300 threads) by using single JMeter on one machine.
Q #4) What is the use of Regular Expression in JMeter?
Answer: Regular expression Extractor is one of the most commonly used Post Processors in JMeter. Load testing professionals who have worked on LoadRunner should be having idea of correlation in LoadRunner.
There are many inbuilt facility provided by LoadRunner, which makes the work of correlation very easy in LoadRunner, same correlation is done through Postprocessorin JMeter.
For beginners, we do not need to understand what correlation is, at this stage. I have just added the concept to make it simple for LoadRunner professionals who want to understand JMeter, I have used the term here.
Though do not have knowledge of LoadRunner should ignore this term at the moment at the moment. Now let us understand why to use Regular Expression Extractor in JMeter and how we use it.
After sending request to server multiple times, we understand one particular template pattern which some dynamic variables which change each time request is made to server) like session variables follow and in order to generalize that pattern, so that we can make large number of request to the web server for large number of users .
What happens is that regular expression extractor extracts the desired value and stores that value in a variable.
Q #5) What are the types of processors in JMeter?
Answer: There are two types of processors in JMeter which are given as below.
There is one major difference between working of the two to which is given as below.
Pre-Processors contain some of the condition that is executed before the execution of main sampler .
Post processor is executed only after the main sampler is executed and if it stores some dynamic value pattern from the responses coming from the server, in the form of variable, then that variable is accessible to all the Sampler of the Test Plan. .
Q #6) What are the different ways of Data Parameterization in JMeter?
Answer: When we have to run a scenario with multiple users, then we need to have multiple data for multiple users.
When we record a scenario with a single user, then we have to replace the data of single user with multiple user data, so that JMeter is able to run the scenario for multiple users.
This is possible only through parameterization. There are different ways in which we do parameterization in JMeter. They are as given below.
• CSV Data Set Config
• User-Defined Variables.
In CSV Data Set Config, we need to create a CSV file on the system where JMeter has been installed, to store data to be used in our scenario for multiple users and for User-Defined Variables, we need to define user defined variable in JMeter window itself .
Q #7) What are the maximum recommended threads on a single system?
Answer: Generally we say that JMeter supports 200 to 300 words per system. We cannot see exactly how threads it support. It totally depends on hardware configuration of the system where it has been installed and hardware configuration may include includes a processor, JVM, allocated memory -Xmx, etc.
There are other components as well which impact thread number count is the number of components, we are using in Test Plan like the number of config elements or processors and it also depends on the mode in which we are using JMeter. It may be GUI or maybe Non-GUI Mode.
Q #8) Explain the difference between Gaussian and Poisson Timers.
Answer: Both Gaussian and Poisson Timers work in similar way. We need to define constant delay and additional offset for both the Timers. But delays produced in both the Timers are different.
They are different because they have different calculation formulas for calculating deviations which lead to different time delays in both the Timers.
Q #9) What are the major differences between JMeter and Load Runner.
Answer: JMeter being so light weighted and being an open source tool is, at today’s time, has become major competitor of Load Runner in the industry. Some of the differences between them are given below.
- Load Runner is licensed software while JMeter is Open Source tool.
- Load Runner is developed by Mercury, while JMeter is developed by Apache.
- UI of Load Runner is very impressive. While JMeter lacks in UI
- Load Runner has more technical capabilities. It has so many features, while JMeter is less technically sound as compared to Load Runner.
- Load Runner supports protocol like SAP, Siebel and Peoplesoft while JMeter does not support SAP and Siebel JMeter
Q #10) What is the use of co-relation in JMeter?
Answer: There are some values in the server response which changes each time request is made to the server. Now when we record script using single user, we cannot use that script for other user because some dynamic values keeps on changing in the response, each time request is made to the server.
Correlation can be considered as a workaround for this. We extract dynamic value pattern from the response coming as a result of request made from different threads in JMeter, which can be used for all the users. Advantage is that we can use the script for multiple numbers of users, irrespective of dynamic values coming in response.
Let us understand it with an example. Let us suppose that we have to test login functionality with multiple users and most of the users generate different session ID/cookie ID, we can capture the pattern of the dynamic values in the response and use it for subsequent request to the server, so that it can be used for all the users.
Q #11) What are the different types of listeners?
Answer: Listeners are a very important element of JMeter. It collects all the execution results of all the samplers and stores the execution results of load testing in different forms.
Results displayed can be in the form of table, graph, tree or in any other presentable format which can be used for result analysis. Some of the listeners available in JMeter are as given below.
• View results in Table
• View results in Tree
• Graph results
• Aggregate graph
• Aggregate report
• Assertion results
• Response time graph
Q #12) Explain the flow of the Test Script Recorder.
Answer: We know that there are many performance testing tools which provide record and playback facility. In JMeter,
it is provided by HTTP(s) Test Script Recorder. It can be used to record all the Http(s) requests sent to the server and very helpful in creating a scenario to perform Load testing and generate load to the server.
However, we need to do some configuration settings to make it work. Let us see some of the steps below which we need to follow in order to configure running HTTP(s) Test Script Recorder.
Add HTTP(s) Test script recorder under the thread group.
- Enter the port number to start your proxy server which is generally 8080 but not mandatory.
- Choose the Target Controller as Recording Controller in your Test Plan and select the same target for storing all the recordings under it.
- Start the proxy server in this HTTP(s) Test Script Recorder window , there is a Start button for it.
- we need to configure the proxy setting in Mozilla Firefox browser which is very easy to do but you have to take care that port which has been defined under HTTP(s) Test Script Recorder should be the same there.
Q #13) Can JMeter record actions from mobile? If yes, how?
Answer: The answer is yes. We know that we can record HTTP or Https requests for web applications using JMeter. In the same way, JMeter can record HTTP or https request for mobile application as well,.
But it also requires some configuration to be made before recording and also worn condition needs to be met and the condition is that both the mobile and JMeter should be on the same network.
They should be not located in different networks otherwise it won’t work. Let us see the configuration which is required for recording mobile application.
- we need to configure proxy server in JMeter to run at a specified port.
- We need to set up the proxy on our mobile wifi settings and also we have to enter the same port number that is used by the recorder.
- Install the Root CA certificate on your mobile.
- we need to generate request from the mobile and see the request captured in the target controller which is a recording controller.
Q #14) How to do master-slave configuration in JMeter?
Answer: Master slave configuration is used in Distributed Testing. Distributed testing is used in the scenario where we require multiple machines to generate load on the target server.
We require multiple machines to generate load on the target server when we are using JMeter because JMeter has Limited capacity and can generate load up to 200 to 300 users only. In this configuration, one machine is made as a master machine and all other machines are made slave machines.
All the machines must be in the same network. Also, we need to use same version of JMeter and Java in all the machines, to be used for generating load in master slave configuration.
Let us see how we will configure master slave configuration. Following are some of the steps which are needed to create master slave architecture configuration.
- We need to go to the master machine, edit the JMeter.properties file and add the IP addresses of slave machines against the remote_host field in the file.
- We should now save the file and open the JMeter again.
- Now, we need to go to RUN menu in JMeter, select Remote Start and choose the IP of the machine to be invoked.
- Now we will go to RUN menu and select Remote Start all to start all the slave machines .
Q #15) What are the JMeter supported protocols?
Answer: There are many protocols that are supported by JMeter. Some of them are given as below.
Q #16) Explain the syntax of JMeter variables and functions.
Answer: We take the help of variables and functions in JMeter to make the script usable in order to create load on the target server for multiple users. If we have defined a variable and we want to access that variable, syntax for doing so is given as below.
JMeter provides inbuilt function to perform various actions. For example, if want to have machine IP in a machineIP variable, we can do so by using the syntax as given below.
Q #17) Why is it not recommended to run JMeter in GUI mode?
Answer: There are many reasons for the same. Let us see some of the reasons given below.
JMeter can handle from 200 to 400 threads on a particular system. It may be even less than that, the configuration is poor. For example, If there is less memory JMeter application can hang or crash.
Second thing is that when we are using elements like Listeners and View Results Tree, it consumes lots of CPU and memory and there are more chances of load testing not to be accurate.
The various Non-GUI mode supported by JMeter are as given below:
• ANT plugin
• MAVEN plugin
Q #18) Is it possible to run selenium scripts in JMeter? If yes, how?
Answer: Yes it is possible. We can run Selenium script in JMeter. We can get to know the performance of the execution of the script. There are two ways of doing it. Let us understand them one by one.
- We can use JUnit libraries to build selenium automation scripts and save the whole script as Jar files and we have to copy the same Jar file in the JMeter directory.
- And then we can add JUnit sampler to your test plan and import the Jar file which we have created from Selenium script. We can run the test and check the performance of the execution of the script
- The second thing we can do is to add the WebDriver sampler plugin in the JMeter ext folder. Now we can restart JMeter. Now we can write selenium code in the WebDriver Sampler and then it can be executed to check the performance.
Q #19) How do you manage sessions and cookies in JMeter?
Answer: We use config elements in Meter’s to manage session and cookies. We can use config element such as HTTP Cache Manager which provides us with an option to clear the cookies in every iteration and also allows us to add user-defined cookies.
We can also clear cache after each iteration by using HTTP Cache manager . It totally depends on the requirement whether we have to clear the cookies or we have to keep the cookies and sessions.
We can also limit the number of elements that can be stored in the cache. We can add these config elements to HTTP sampler.
Q #20) What are the important steps for testing JDBC request?
Answer: JDBC requests is used to measure the response time of queries written to perform some operation on the database.
For measuring the performance of the queries related to database, first of all, we need to establish a connection with the database. Let us see how we do it in JMeter.
We should follow the following steps to establish a connection with database and measure the performance of database queries.
First step we need to do is to setup Config Element, JDBC Connection configuration in which we add some important properties like Database URL and JDBC Driver Class .
Also, we need to add the variable name for this connection configuration so as to use it in the Sampler.
Add JDBC Request. We need to add the same variable which contains the connection string to database and write queries to perform out test .
Q #21) What is BeanShell scripting?
Answer: There are situations when we are required to use some scripting in order to perform some tasks. BeanShell is very useful scripting language used in JMeter.
It is very lightweight Java scripting that is used in JMeter to perform some complex task. We can use various functions of BeanShell Sampler to perform different tasks. For example, we can print the thread number, get the current sampler executed, fetch the cookies, etc.
Q #22) Can JMeter measure the performance of a complete application? For Example, you have multiple screens in your mobile app. Can JMeter measure the time taken to flip the screens?
Answer: No, JMeter cannot do so . It can only measure the request that is sent to the server and response coming from the server. It cannot measure anything that is going on the mobile itself. It can only measure something which goes to the server.
Q #23) What is a Root CA certificate?
Answer: Root CA certificate is a temporary certificate generated by JMeter in order to intercept SSL traffic so that it can record the action that is going from client to server and vice versa.
We need to have the certificate installed on our system on which JMeter is installed. Same thing happens with mobile. If we have to record action through mobile, we need to have this certificate installed on the mobile.
Q #24) Which factors decide the maximum threads that one should generate per system?
Answer: To define number of threads supported by JMeter totally depends upon the hardware of the system where JMeter has been installed. Let us understand it with the help of example.
If we have 2-3 GHz CPU on our system, we can generate 400-600 threads. There are other things also which comes into play and should be considered for defining number of threads, like components of test plan.
More is the number of processors and XML parsing elements, more is the CPU load and henceforth, it will support the number of threads. This is only the reason why distributed testing is done using multiple machines to generate heavy load on server.
Q #25) What is a Workbench and why is it required?
Answer: Workbench is not available in current version of JMeter anymore. But it was available earlier. So, for knowledge purpose, we can understand it. Work bench could be considered as storage Area where we could add some components of Test Plan if required.
Recording elements such as HTTP(s) Test script recorder were added to workbench only for recording purpose which is not so in current version of JMeter. We can simply add it inside Thread Group in current version of JMeter.
it is important to prepare for interview in question and answer format . Questions and answers given above are frequently asked questions for JMeter interview and it would surely help aspiring candidates who want to make a career in JMeter. Also, it would enrich your knowledge on JMeter concepts to a great extent.