JMeter Interview Questions and Answers

1). Explain what is JMeter?

JMeter is a Java tool, which is used for performance Load Testing.

2) Explain how JMeter works?

JMeter acts like a group of users sending requests to a target server. It collects response from the target server and other statistics which show the performance of the application or server via graphs or tables.

3) Explain where you can use functions and variables?

Variables and functions can be written into any field of any test component

4) Mention what are regular expressions in JMeter?

Based on the pattern, a regular expression is used to search and manipulate text. JMeter is useful in interpreting forms of regular expression or patterns being used throughout a JMeter test plan.

5) Explain what is Samplers and Thread groups?

Thread group : For any test plan, JMeter is the beginning part of thread group elements. It is an important element of JMeter, where you can set a number of users and time to load all the users given in the thread group

Samplers : Sampler generates one or more sample results; these sample results have many attributes like elapsed time, data size, etc.
Samplers allow JMeter to send specific types of requests to the server, through samplers, thread group decides which type of request it needs to make. Some of the useful samplers are HTTP requests, FTP requests, JDBC requests, and so on.

6) Whether the test plans built using JMeter are OS-dependent?

Usually, Test Plan is saved in their XML format, so there is nothing to do with any particular O.S. It can be run on any OS where JMeter can run.

7) Mention what are the types of a processor in JMeter?

The types of a processor in JMeter are

  • Pre-processor
  • Post-processor

8) Explain what are Pre-processor Elements? List some of the pre-processor elements?

A pre-processor is something that will happen before the sampler executes. To configure the sample request prior to its execution or to update variables that are not extracted from response text pre-processor elements are used.

Some of the pre-processor elements are

  • HTTP URL re-writing modifier
  • HTTP user parameter modifier
  • HTML link parser
  • BeanShell PreProcessor

9) Mention the execution order of Test Elements?

The test plans elements execution order is

Configuration elements

  • Pre-processors
  • Timers
  • Samplers
  • Post-processors
  • Assertions
  • Listeners

10) What does “contain” and “matches” indicates in the regular expression?

The regular expression contains indicates that the regular expression matched at least some part of the target. While matches mean the regular expression matched the whole target. So, the ‘alphabet’ is “matched” by ‘al.*t.’

11) Explain what is the configuration elements?

A configuration element works parallel with a Sampler. To set up defaults and variables for later use by samplers configuration elements can be used. At the start of the scope, these elements are processed before any samplers in the same scope.

12) Explain what is a timer in JMeter and what are the types of it?

A JMeter thread by default will send requests continuously without any pause. To get a pause between the request, Timers are used. Some of the Timers used are Constant Timer, Gaussian Random Timer, Synchronizing Timer, Uniform Random Timer, and so on.

13) Explain what is Test Fragment?

Test fragment is also a type of element like the Thread Group element. The only difference is test fragment is not implemented unless it is referenced by either a Module controller or an Include controller.

14) Explain what is Assertion in JMeter? What are the types of assertions?

Assertion helps to verify that your server under test returns the expected results

Some commonly used Assertion in JMeter are

  • Response Assertion
  • Duration Assertion
  • Size Assertion
  • XML Assertion
  • HTML Assertion

15) Explain how you can reduce the resource requirement in JMeter?

To reduce the resource requirements in JMeter

  • Use the non-GUI mode: jmeter –n –t-test.jmx –l test.jtl
  • During the load, a test doesn’t use “view results tree” or “view results in the table” listeners, use them only during the scripting phase
  • Don’t use functional mode
  • Instead of using lots of similar samplers, use the same sampler in a loop and use the variable to vary the sample

16) Explain how you can perform spike testing in JMeter?

By synchronizing, timer JMeter spike Testing can be achieved. Synchronizing timer blocks thread until a specific amount of threads has been blocked and then releases them all together thus creating a sizeable instantaneous load.

17) Explain how you can capture the script of the authentication window in JMeter?

Usually, you can capture the script by recording.

First, you have to Threadgroup in Testplan and then make HTTPProxyServer in Workbench
After that, set port number in the Global Setting box (e.g., 8911) and modify your connection setting in IE as localhost in address 8911 as in port Then you can start http proxy server in JMeter and run your application for login

18) List out a few JMeter Listeners?

Some of the JMeter Listeners are

  • Spline Visualizer
  • Aggregate Report
  • View Result Tree
  • View Result in Table
  • Monitor Results
  • Distribution Graph
  • BeanShell Listener
  • Summary Report

19) What is distributed load testing? How can it be achieved?

Distributed load testing is the process through which numerous systems can be used for simulating a load of a large number of users. By using the master-slave configuration, JMeter can do distribute load testing.

20) In JMeter is it necessary to call embedded resources explicitly?

You can eliminate all embedded resources from being explicitly called. Requests have a checkbox at the bottom that says “retrieve embedded resources.” It would grab all CSS, JPG, etc. It is a brilliant way to find resources and broken links in a web App.

21) Explain what is the role of Timer in JMeter?

With the help of a timer, JMeter can delay the time between each request, which a thread makes. It can solve the overload problem of the server.

22) Explain what is Post-processor?

To perform any action after making a request, Post-processor is used. For example, if JMeter sends an HTTP request to the web server, and if you want JMeter to stop sending the request if the webserver shows an error, then you will use post-processor to perform this action.

23) What are the benefits that JMeter offers for performance testing?

JMeter offers benefits on Performance Testing like

  • It can be used to test performance for both, static resources as well as dynamic resources.
  • It can handle a maximum number of concurrent users then your website can handle.

24). What is JMeter? What are the other applications that can be tested using JMeter?

Apache JMeter is open-source software. It is 100% pure Java desktop application designed to load test functional behavior and measure performance of the client/server applications.

  • It was originally designed for testing Web Applications only but has since then evolved to test other apps.
  • It’s useful in testing the performance of both static and dynamic resources like files, Servlets, Perl scripts, Java Objects, Data Bases, Queries, FTP Servers, and more.
  • JMeter can also perform various other types of testing like Functional, Regression, and Unit testing.
  • It provides graphical analyses of performance reports.

25). Explain the basic workflow of JMeter?

JMeter acts like a group of users sending requests to a target server. It collects response from target server and other statistics which depict the performance of the application or server via graphs or tables.

26). Name the protocols supported by JMeter?

The following are some of the protocols supported by JMeter.

  • Web Protocol : To test the web applications, it supports both HTTP and HTTPS protocols.
  • Web Services: To test web services applications, it supports both SOAP and REST.
  • FTP: File Transfer Protocol provides the support for testing the FTP servers and applications.
  • Database via JDBC: used for testing the database applications.
  • LDAP: Lightweight Directory Access Protocol
  • Message-oriented middleware (MOM) via JMS
  • Mail: used for testing of mail servers such as SMTP(S), POP3(S) and IMAP(S)
  • MongoDB (NoSQL): it is a recently supported protocol by JMeter.
  • Native commands or shell scripts
  • TCP

27). List the important features that JMeter supports?

The following are some of the key features of JMeter.

  • It’s open-source software and is freely available.
  • It has a very simple and intuitive GUI.
  • JMeter can do load and performance tests of many different server types like Web – HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail via POP3.
  • It is a platform-independent tool. On Linux or Unix, the user can open the JMeter tool by clicking on the JMeter shell script. However, on Windows, it can be invoked by starting the jmeter.bat file.
  • It has full Swing and lightweight component support (precompiled JAR uses packages java.swing.* ).
  • JMeter prepares test plans in XML format.
  • It’s a full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
  • It is highly extensible.
  • It can also be used to perform automated and functional testing of your application.

28). What is seen on the screen when you open a JMeter?

By default, the JMeter screen displays the Test Plan and Workbench tabs.

29) What is a Test Plan in JMeter? List some of the test plan elements available in JMeter.

A Test Plan defines and provides a layout of how and what to test. JMeter can be used to prepare a Test Plan for the web application as well as the client-server application. It behaves like a container for running tests.

A complete Test Plan comprises one or more of the following elements.

  • ThreadGroup
  • Controllers
  • Listeners
  • Timers
  • Assertions
  • Configuration Elements
  • Pre-Processor Elements
  • Post-Processor Elements

A Test Plan should have at least one thread group.

30). Explain the role of Workbench?

It is merely an area to store test elements while you are in the process of constructing a test. Once you’ve finished designing the test items in the Workbench, you can copy or move them into the Test Plan.

It also contains non-test elements like :

  • Http mirror server
  • HTTP proxy server

These items aren’t available in the thread group and Test plan.

31). What is a Thread Group? List down its main parts?

Thread group elements are the beginning points of any Test Plan. It is mandatory to have at least one thread group in the Test Plan.

One should know the following about the Thread Group.

  • All controllers and samplers must be under a thread group.
  • Listeners may be placed directly under the test plan, in which case they will apply to all the thread groups.
  • The controls for a thread group allows you to:
    • set the number of threads.
    • Define the ramp-up period.
    • Sets the number of times to execute the test.

The following are the parts of a thread group.

  • Sampler : It sends various types of requests to the server.
  • Listeners : It saves the results of the Run. It can be opened for viewing also.
  • Timer : It makes the run more realistic by inserting delays between the requests.
  • Controller : It is responsible for controlling the flow of the thread group. An example scenario is where the request definition includes if-then-else or loop structure.
  • Config Element : information about the requests to be added to work with samplers.
  • Assertion : To check if the response is generated within the given time and contain the expected data.

32). What are JMeter controllers? Explain their types?

JMeter provides two types of Controllers.

  • Samplers Controllers : It enables JMeter to post specific types of requests to a server. It simulates a user’s request for a page from the target server.
    Example : For example, you can add an HTTP Request sampler if you need to perform a POST, GET, or DELETE operation on an HTTP service.
  • Logical Controllers : It lets you control the order of processing of Samplers in a Thread. Logic Controllers can change the order of requests coming from any of their child elements.
    Examples: ForEach Controller, While Controller, Loop Controller, IF Controller, Run Time Controller, Interleave Controller, Throughput Controller, and Run Once Controller.

33). What is a Configuration element? List down its elements.

  • Configuration Element allows you to create defaults and variables to be used by Samplers. It can be used to add or modify requests made by the Samplers.
  • It will get executed at the beginning of the scope before any Samplers present in the same range. Thus, we can say that access to a configuration element is only allowed from inside the branch where it is present.

The following are the key features of Configuration Element.

  • CSV Data Set Config: It supports reading line by line from a file and splitting the line into variables.
  • HTTP Authorization Manager: You can specify one or more user logins for web pages that are restricted using server authentication.
  • Java Request Defaults: Using this you can set default values for Java testing.
  • HTTP Cookie Manager: The Cookie Manager element has two functions:
  • It stores and sends cookies just like a web browser.
  • Second, you can manually add a cookie to the Cookie Manager. However, if you do this, the cookie will be shared by all JMeter threads.
  • HTTP Request Defaults: It lets you set default values to be used by your HTTP Request controllers.
  • HTTP Header Manager: It enables you to add or override the HTTP request headers.

34. What are Listeners? List out a few JMeter Listeners.

It enables you to view the results of Samplers in the form of tables, graphs, trees, or simple text in some log files. It provides visual access to the data gathered by JMeter for the test cases executed for the Sampler component of JMeter.

JMeter supports the addition of Listeners anywhere in the tests that are included directly in the Test Plan. They will collect data only from elements at the same or lower level.

Some of the important JMeter Listeners are as follows.

  • Spline Visualizer
  • Aggregate Report
  • View Result Tree
  • View Result in Table
  • Monitor Results
  • Distribution Graph(alpha)
  • Bean Shell Listener
  • Summary Report
  • Aggregate Graph
  • Assertion Results
  • Backend Listener
  • Comparison Assertion Visualizer
  • Generate summary results
  • Graph Results
  • JSR223 Listener
  • Mailer Visualizer
  • Response Time Graph
  • Save responses to a file
  • Simple data writer

35. Explain what is Pre-processor Element? Name a few of them.

It enables configuring a sample request before executing it or to update those variables present in the response text that may not be extracted.

Some of the main pre-processor elements are as follows.

  • A modifier for HTTP URL.
  • HTTP user parameter modifier.
  • HTML link parser.
  • BeanShell pre-processor.

36 Explain what is Post-processor?

Post-processors get used for calling an action after a request is made.

For example: suppose JMeter sends an HTTP request to the web server, and the user wants JMeter to stop sending the invitation. If the webserver shows an error, in this case, the user can use the post-processor to perform this action.

37. What is the execution order of Test Elements in the Test Plan of JMeter?

Following is the order of execution of the Test Plan elements.

  • Configuration elements
  • Pre-Processors
  • Timers
  • Sampler
  • Post-Processors (unless SampleResult is null)
  • Assertions (unless SampleResult is null)
  • Listeners (unless SampleResult is null)

38. Is it required to prepare a separate Test Plan using JMeter for the testing of the same application on different Operating Systems?

The following facts support that a JMeter Test Plan can run on any OS.

  • JMeter is itself a pure Java-based application which makes it platform-independent.
  • JMeter uses XML format while saving a Test Plan. Thus, they have nothing to do with any particular OS. You can run those Test Plans on any OS where JMeter can run.

39. How do you ensure re-usability in your JMeter scripts?

Taking the following points into consideration we can encourage re-usability in the test scripts:

  • I am using config elements like “CSV Data Set Config” and “User-Defined Variables” for supporting greater data reuse.
  • Modularizing the shared tasks and invoking them via a “Module Controller”.
  • Creating own Bean Shell functions and reusing them.

40. How can you reduce resource requirements in JMeter?

The following are the tricks that help in reducing resource usage.

  • Use a non-GUI mode.
    jmeter -n -t test.jmx -l test.jtl‚Äč
  • It is better to use as few Listeners as possible. Applying the “-l” flag as shown in the above point may delete or disable all the Listeners.
  • Disable the “View Result Tree” listener as it consumes a lot of memory and may result in the JMeter tool running out of memory. It will freeze the console too. It is, however, safe to use the “View Result Tree” listener with only “Errors” kept checked.
  • Instead of using a similar Sampler a large number of times, use the same Sampler in a loop and use variables (CSV Data Set) to vary the sample data. Or perhaps use the Access Log Sampler.
  • Avoid using functional mode.
  • Use CSV output rather than XML.

Also, you may like to read some of the common points.

  • Try to save the data that you need.
  • Use as few Assertions as possible.
  • Disable all JMeter graphs as they consume a lot of memory. All the real-time graphs can be viewed using the JTL tab in the web interface.
  • Do not forget to erase the local path from CSV Data Set Config when used.
    Cleaning of the Files tab before every test run.

41. List the benefits that JMeter offers for performance testing?

JMeter provides the following advantages for performance testing.

  • It can be used to test performance for both, static resources as well as dynamic resources.
  • It can generate and handle a large number of concurrent users as it happens on a live website.
  • It provides a graphical analysis of performance reports.

42. Explain what is Assertion in JMeter? List its types.

Assertion helps to verify that the server under test returns the expected results.

Some commonly used Assertion in JMeter are as follows.

  • Response Assertion : It facilitates the user by comparing the server response against a string pattern to check that the result is as expected. For Example, while waiting for a response from the server the Response Assertion role is to verify that the server response has probable pattern string, “OK” or not.
  • Duration Assertion : You may need to test the response from the server reaches in user-defined time. If it takes longer than the defined time, the server response fails.
  • Size Assertion : It is to test that each response coming from the server holds the expected number of bytes. It facilitates the user to specify the size i.e. equal to, greater than, less than or not equal to a given number of bytes. For example, if the response packet from a server is less than expected 5000 bytes in size, then a test case pass, else a test case fails.
  • XML Assertion : It verifies that the response coming from the server holds the data in a correct XML format.
  • HTML Assertion : It is helpful for checking the syntax of the response data.

43. What is Spike testing and how can we perform it in JMeter?

Suddenly increasing the number of users at a certain point of application and then monitoring its behavior at that interval is Spike testing.

In JMeter, Spike testing can be performed using Synchronizing Timer. This timer keeps on blocking the threads until a particular number of threads get reserved. It then releases them at once thus creating a large instantaneous load.

44. Explain the architecture of JMeter.

Jmeter is a Java-based open-source application that is basically designed for the purpose of Load Testing. It supports all major protocols that are supported in Load Runner. Unlike any browser, JMeter works on levels of protocols and does not execute JavaScript present in HTML web pages.

45. Does JMeter simulate actual browser behavior?

No, JMeter does not support the actual browser behavior. It does not render the HTML webpages as the normal browser does. The response can be viewed in HTML format but the actual timings are not present in the generated samples.

46. What is Distributed testing?

Distributed Testing means using multiple machines for load testing in which one of the machines can be made master and others can be kept as a slave. It is very important to note that all the machines should be on the same network and should have the same version of Java and JMeter.

47. What is the use of Regular Expression in JMeter?

Regular Expression is used to extracting some values dynamically from the responses. These values can be used in the subsequent request or can be saved for reporting purposes. Regular Expression is used in both Pre-Processors as well as Post Processors.

48. What are the types of processors in JMeter?

Basically there are two types of processors in JMeter namely Pre-Processor and Post Processor. Pre-Processors execute before the main sampler and can change the scope of the sampler whereas Post Processors execute after the main sampler and are applicable to all samplers in the same scope of Test Plan. They can be used to extract some fields from the server response and store them in variables.

49. What are the different ways of Data Parameterization in JMeter?

Data Parametrization makes the scripts reusable where the values are not required to be hardcoded for the same request with different parameters.

Below is the data parametrization that is supported in JMeter :

  • CSV Data Set Config
  • User-Defined Variables.

50. What are the maximum recommended threads on a single system?

It depends on the hardware configuration of your system which includes a processor, JVM, allocated memory -Xmx, etc.

Other factors that impact thread count are the number of components in your test plan i.e. the number of config elements or processors and it also depends on whether you are using GUI/Non-GUI Mode.

51. Explain the difference between Gaussian and Poisson Timers.

Answer: Both Gaussian and Poisson Timers work on a mathematical formula with some constant delay and additional offset. Difference between the two lies in the fact that how the lambda value is calculated in the case of Poisson timer and how deviation is calculated in the case of Gaussian Timer.

52. What are the major differences between JMeter and Load Runner?

JMeter is considered as the major competitor of Load Runner in the industry. Enlisted are some of the major differences:

  • Load Runner Jmeter
  • Licensed Software Open Source tool.
  • Developed by Mercury Developed by Apache.
  • UI is very impressive It lacks in UI
  • It has more technical capabilities. Less technically sound as compared to Load Runner.
  • Supports SAP, Siebel, and Peoplesoft. Doesn’t support SAP and Siebel

53. What is the use of co-relation in JMeter?

Co-relation is a process of extracting the values from the server response and storing it in a variable to be used in any other request which is to follow.

Example: for testing any login functionality if you have to use the session ID/cookie ID, you can extract the values from the response of getting Request of the login page and then dynamically use the same while making POST request for a login.

54. Explain the flow of the Test Script Recorder.

HTTP(s) Test Script Recorder is used to record all the Http(s) requests going to the server from your application. Some configurations require to be done in JMeter in order to make it work.

Steps followed to record https traffic is :

  • Add HTTP(s) Test script recorder to WorkBench.
  • Enter the port number to start your proxy server.
  • Choose the target either as “Workbench” or add a Recording Controller in your test plan and select the same target for storing all the recordings under it.
  • Start the proxy server.
  • Configure your browser with manual proxy settings pointing to the same port number used in the test script recorder.

55. Can JMeter record actions from mobile? If yes, how?

Yes, JMeter can record HTTP or Https requests going to the server from your mobile application also. It is required that mobile and JMeter are on the same network.

Below is the configuration required :

  • Configure your proxy server in JMeter to run at a specified port.
  • Set up the proxy on your mobile wifi settings and enter the same port number that is used in the recorder.
  • Install the Root CA certificate on your mobile.
  • Hit server requests from your mobile and observe it getting captured by the specified controller.

56. How to do a master-slave configuration in JMeter?

Master-slave configuration is a part of distributed testing in which more than one machine is used to perform load testing of the server under test.

It is very important that all machines are on the same network and all have the same version of JMeter. In distributed testing, one machine considered as the master, and the others are kept as slaves by doing some configurations.

The process is specified below :

  • On the master machine, edit the JMeter.properties file and add the IP addresses of slave machines against the remote_host field in the file.
  • Save the file and open the JMeter again.
  • Now, from the RUN menu in JMeter, select Remote Start and choose the IP of the machine to be invoked.
  • Choose the RUN menu and select Remote Start all to start all the slave machines for your testing.

57. What are the JMeter supported protocols?

JMeter supports various standard protocols like:

  • HTTP/HTTPs
  • SOAP
  • LDAP
  • FTP
  • SMTP
  • TCP

58. Explain the syntax of JMeter variables and functions.

Just as in any other programming language, variables and functions are used in JMeter also in order to make the scripts reusable.

Syntax of Variable – ${var}

There are many inbuilt functions that are available in JMeter to perform various actions. Function string can be generated from the Function Dialogue Box itself.

Example: if you want to get the machine IP stored in a machine variable, you can use the string ${__machineIP(machine)}.

59. Why is it recommended to run JMeter in GUI mode?

JMeter tests can be run both GUI as well as Non-GUI Mode. It is highly recommended to run the load test in Non-GUI mode because the AWT event thread can kill the tests in case of high load scenarios.

The various Non-GUI mode supported with JMeter are :

  • Command-line
  • ANT plugin
  • MAVEN plugin
  • Jenkins

60. Is it possible to run selenium scripts in JMeter? If yes, how?

Yes, it is possible to run selenium scripts in JMeter to get some ideas on their performance.

There are two ways of doing it. Either you can use JUnit libraries to build selenium scripts and save as Jars and copy the same in the JMeter directory. And then add JUnit sampler to your test plan and import the Jar file.

Otherwise, the Webdriver sampler plugin can be added in the JMeter ext folder. Restart the JMeter. Write your selenium code in the Webdriver sampler and then execute it to see the performance.

61. How do you manage sessions and cookies in JMeter?

Sessions and cookies can be managed in JMeter by using config elements such as HTTP Cache Manager which provides an option to clear the cookies in every iteration and also allows to add user-defined cookies.-

HTTP Cache manager helps you in clearing cache after each iteration as per your requirement in the load tests and also limits the number of elements that can be stored in the cache. Both of these config elements can be attached to the HTTP sampler.

62. 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?

No, JMeter does not measure the transition time between the screens. It can only measure server actions, not UI interactions.

63. What is a Root CA certificate?

HTTPS connection requires a certificate to authenticate the connections which get established when the browser hits the webserver. JMeter generates it temporarily to intercept the SSL traffic in order to record the actions. For recording actions via mobile, you need to have this certificate on your mobile to record the actions.

64. Which factors decide the maximum threads that one should generate per system?

It depends on the hardware of the system.

Example: On a 2-3 GHz CPU, 400-600 threads can be generated. It also depends on the components in your test plan. More the processors and XML parsing elements, the more the CPU load and hence fewer threads. For high load, it is recommended to use multiple machines for load testing.

65. What is a Workbench and why is it required?

Workbench is a storage area for adding some components which can be added to the test plan if required.

Components of workbench do not get saved with the test plan automatically. They have to be saved separately as test fragments. A most important part of the Workbench is HTTP(s) Test script recorder which is highly useful in recording the https request and later load can be applied to+9859 them to measure the response time.

66. What is Tidy Parsing?

Tidy Parsing is a type of parsing that is used in Xpath extractor. If the response is in pure XML then tidy parsing is not required whereas, in the case of XHTML, it is mandatory to check the tidy parsing option in order to fetch the correct results.

67. What are the important plugins that are supported in JMeter?

JMeter supports different types of plugins which are helpful in generating high-quality results.

Below are the major plugins that are supported :

  • Thread group plugin – Stepping thread group plugin.
  • Samplers plugins like Webdriver.
  • Listeners plugins.
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions