Jmeter interview Questions & Answers


Q01. Explain what is Jmeter?
Answer:
JMeter is a Java tool, which is used for performance Load Testing.
Q02. Explain how JMeter works?
Answer:
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.
Q03. Explain where you can use functions and variables?
Answer:
Variables and functions can be written into any field of any test component
Q04. Mention what are regular expressions in Jmeter?
Answer:
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.
Q05. Explain what is Samplers and Thread groups?
Answer:
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 request, FTP request, JDBC request and so on.
Q06. Whether the test plans built using JMeter are OS dependent?
Answer:
Usually, Test Plan are saved in their XML format, so there is nothing to do with any particular OS. It can be run on any OS where JMeter can run.
Q07. Mention what are the types of a processor in Jmeter?
Answer:
The types of a processor in JMeter are Pre-processor
Post processor.
Q08. Explain what are Pre-processor Elements? List some of the pre-processor elements?
Answer:
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
Bean-Shell Preprocessor
Q09. Mention the execution order of Test Elements?
Answer:
The test plans elements execution order is
Configuration elements
Pre-processors
Timers
Samplers
Post-processors
Assertions
Listeners
Q10. What does “contain” and “matches” indicates in the regular expression?
Answer:
In 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, ‘alphabet’ is “matched” by ‘al.*t.’
Q11. Explain what is the configuration elements?
Answer:
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.
Q12. Explain what is a timer in JMeter and what are the types of it?
Answer:
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.
Q13. Explain what is Test Fragment?
Answer:
Test fragment is also a type of element like 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.
Q14. Explain what is Assertion in JMeter? What are the types of assertion?
Answer:
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
Q15. Explain how you can reduce the resource requirement in Jmeter?
Answer:
To reduce the resource requirements in JMeter
Use 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 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
Q16. Explain how you can perform spike testing in Jmeter?
Answer:
By synchronizing, timer JMeter spike Testing can be achieved. Synchronizing timer blocks thread until a specific amount of threads has been blocked and then release them all together thus creating large instantaneous load.
Q17. Explain how you can capture the script of the authentication window in Jmeter?
Answer:
Normally, you can capture script by recording.
First, you have to Thread group in Test plan and then make HTTP Proxy Server in Workbench
After that, set port number in the Global Setting box (e.g., 8911) and modify your connection setting in IE as local host in address 8911 as in port Then you can start http proxy server in JMeter and run your application for login
Q18. List out few JMeter Listeners?
Answer:
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 and so on
Q19. What is distributed load testing? How can it be achieved?
Answer:
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.
Q20. In JMeter is it necessary to call embedded resources explicitly?
Answer:
You can eliminate all embedded resources from being explicitly called. Requests have a check-box 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 link in a web App.
Q21. Explain what is the role of Timer in Jmeter?
Answer:
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.
Q22. What Is JMeter? What Are The Other Applications That Can Be Tested Using Jmeter?
Answer:
Apache JMeter is an open source software. It is 100% pure Java desktop application designed to load test functional behavior and measure performance of the client/server applications.
1. It was originally designed for testing Web Applications only but has since then evolved to test other apps.
2. 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.
3. JMeter can also perform various other types of testing like Functional, Regression, and Unit testing.
Q23. Explain The Basic Work-flow Of Jmeter?
Answer:
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.
Q24. Name The Protocols Supported By Jmeter?
Answer:
Following are some of the protocols supported by JMeter.
1. Web Protocol: To test the web applications, it supports both HTTP and HTTPS protocols.
2. Web Services: To test web services applications, it supports both SOAP and REST.
3. FTP: File Transfer Protocol provides the support for testing the FTP servers and applications.
4. Database via JDBC: used for testing the database applications.
5. LDAP: Lightweight Directory Access Protocol
6. Message-oriented middle-ware (MOM) via JMS
7. Mail: used for testing of mail servers such as SMTP(S), POP3(S) and IMAP(S)
8. MongoDB (NoSQL): it is recently supported protocol by JMeter.
9. Native commands or shell scripts
10. TCP
Q25. List The Important Features That JMeter Supports?
Answer:
Following are some of the key features of JMeter.
1. It’s open-source software and is freely available.
2. It has a very simple and intuitive GUI.
3. JMeter can do load and performance test of many different server types like Web – HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail via POP3.
4. 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.
5. It has full Swing and lightweight component support (precompiled JAR uses packages java.swing.* ).
6. JMeter prepares test plans in XML format.
7. It’s a full multi threading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
8. It is highly extensible.
9. Can also be used to perform automated and functional testing of your application.
Q26. What Is A Test Plan In JMeter? List Some Of The Test Plan Elements Available In Jmeter.
Answer:
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 of one or more of the following elements.
1. Thread Group
2. Controllers
3. Listeners
4. Timers
5. Assertions
6. Configuration Elements
7. Pre-Processor Elements
8. Post-Processor Elements
Q27. What Is A Thread Group? List Down Its Main Parts?
Answer:
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.
1. All controllers and samplers must be under a thread group.
2. Listeners may be placed directly under the test plan, in which case they will apply to all the thread groups.
3. The controls for a thread group allows you to:
i. set the number of threads.
ii. Define the ramp-up period.
iii. Sets the number of times to execute the test.
Following are the parts of a thread group.
1. Sampler: It sends various types of requests to the server.
2. Listeners: It saves the results of the Run. It can be opened for viewing also.
3. Timer: It makes the run more realistic by inserting delays between the requests.
4. 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.
5. Config Element: information about the requests to be added to work with samplers.
6. Assertion: To check if the response is generated within the given time and contain the expected data.
Q28. What Are JMeter Controllers? Explain Their Types?
Answer:
JMeter provides two types of Controllers.
1. 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.
For example, you can add an HTTP Request sampler if you need to perform a POST, GET, or DELETE operation on an HTTP service.
2. Logical Controllers: It lets you control the order of processing of Samplers in a Thread. Logic Controllers can change the order of request coming from any of their child elements.
Q29. What Is A Configuration Element? List Down Its Elements.
Answer:
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.
Following are the key features of Configuration Element.
1. CSV Data Set Config: It supports reading line by line from a file and splitting the line into variables.
2. HTTP Authorization Manager: You can specify one or more user logins for web pages that are restricted using server authentication.
3. Java Request Defaults: Using this you can set default values for Java testing.
4. HTTP Cookie Manager: The Cookie Manager element has two functions:
i. It stores and sends cookies just like a web browser.
ii. 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.
5. HTTP Request Defaults: It lets you set default values to be used by your HTTP Request controllers.
6. HTTP Header Manager: It enables you to add or override the HTTP request headers.
Q30. Explain What Is Post-Processor?
Answer:
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 request. If the web server shows an error, in this case, the user can use post-processor to perform this action.
Q31. What Is The Execution Order Of Test Elements In Test Plan Of Jmeter?
Answer:
Following is the order of execution of the Test Plan elements.
1. Configuration elements
2. Pre-Processors
3. Timers
4. Sampler
5. Post-Processors (unless Sample Result is null)
6. Assertions (unless Sample Result is null)
7. Listeners (unless Sample Result is null
Q32. Is It Required To Prepare Separate Test Plan Using JMeter For The Testing Of The Same Application On Different Operating System?
Answer:
Following facts support that a JMeter Test Plan can run on any OS.
1. JMeter is itself a pure Java-based application which makes it platform independent.
2. 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.
Q33. How Do You Ensure Re-Usability In Your JMeter Scripts?
Answer:
Taking the following points into consideration we can encourage re-usability in the test scripts:
1. Using config elements like “CSV Data Set Config” and “User Defined Variables” for supporting greater data reuse.
2. Modularizing the shared tasks and invoking them via a “Module Controller”.
3. Creating own Bean Shell functions and reusing them.
Q34. How Can You Reduce Resource Requirements In Jmeter?
Answer:
Following are the tricks that help in reducing resource usage.
1. Use a non-GUI mode.
jmeter -n -t test.jmx -l test.jtl
2. It is better to use as few Listeners as possible. Applying the “-l” flag as shown in above point may delete or disable all the Listeners.
3. Disable the “View Result Tree” listener as it consumes a lot of memory and may result in 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.
4. 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.
5. Avoid using functional mode.
6. Use CSV output rather than XML.
Also, you may like to read some of the common points.
7. Try to save the data that you need.
8. Use as few Assertions as possible.
9. 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.
10. Do not forget to erase the local path from CSV Data Set Config when used.
11. Cleaning of the Files tab before every test run.
Q35. List The Benefits That JMeter Offers For Performance Testing?
Answer:
JMeter provides the following advantages for performance testing.
1. It can be used to test performance for both, static resources as well as dynamic resources.
2. It can generate and handle a large number of concurrent users as it happens on a live website.
3. It provides a graphical analysis of performance reports.
Q36. Explain What Is Assertion In JMeter? List Its Types.
Answer:
Assertion helps to verify that the server under test returns the expected results.
Some commonly used Assertion in JMeter are as follows.
1. 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.
2. 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, server response fails.
3. Size Assertion: It is to test that each response coming from 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.
4. XML Assertion: It verifies that the response coming from the server holds the data in a correct XML format.
5. HTML Assertion: It is helpful for checking the syntax of the response data.

Q37. How Do You Ensure Re-ease of use In Your Jmeter Scripts?

Answer:
Utilizing config components like “CSV Data Set Config”, “Client Defined Variables”, and so on for more prominent information reuse.
Modularizing shared errands and conjuring them through a “Module Controller”.
Composing your own Bean-Shell capacities, and reusing them.

Q38. What is the distinction among gauge and benchmark testing?

Answer:
The contrasts among pattern and benchmark testing are:
  1. Pattern testing is the way toward running a lot of tests to catch execution data. This data can be utilized as a point of reference when in future changes are made to the application while Benchmarking is the way toward looking at your framework execution against an industry standard that is given by some other association.
  2. Precedent: We can run benchmark trial of an application, gather and investigate results, and afterward alter a few files on a SQL Server database and run a similar test once more, utilizing the past outcomes to decide if the new outcomes were better, more terrible, or about the equivalent.

Q39. What is a root CA declaration?

Answer:
HTTPS association requires an endorsement to confirm the associations which get set up when the program hits the web server. JMeter produces it incidentally to catch the SSL traffic so as to record the activities. For account activities by means of versatile, you need this endorsement in your portable to record the activities.

Q40. Would we be able to utilize Selenium Automated Scripts in JMeter?

Answer:
Indeed, we can run selenium contents in JMeter to get a few thoughts on their execution. It very well may be done in 2 different ways.
You can utilize JUnit libraries to fabricate Selenium contents and spare as Jars and duplicate the equivalent in JMeter registry. And after that add Junit sampler to your test plan and import the Jar record.
Something else, Web driver sampler module can be included the JMeter Ext organizer and after that restart the JMeter. Compose your selenium code in the Web driver sampler and afterward execute to see the execution.

Q41. Why does JMeter become a natural choice of the tester when it comes to performance testing?

Answer:
JMeter tool has benefits like

  • It can be used for testing both static resources like HTML and JavaScript, as well as dynamic resources like Servlets, Ajax, JSP, etc.
  • JMeter has a tendency to determine the maximum number of concurrent users that your website can handle
  • It provides a variety of graphical analyses of performance reports
  • It is free
  • Plug-ins are available to extend the features
Q42. What are the different ways of Data Parametrization in JMeter?


Answer:

Data Parametrization makes the scripts reusable where the values need not be hard coded for the same request with different parameters. Below is the data parametrization that is supported in JMeter:
a.CSV Data Set Config
b. User Defined Variables
c. User Parameter
Q43. How to reduce the memory requirement for execution using JMeter?


Answer:

To reduce the memory requirements following steps need to be followed:
a. Use non-GUI mode for test execution using below command:
jmeter –n –t test.jmx –l test.jtl
b. Do not use listeners or disable them before the test started.
c. Don't use functional mode.
d. Try to implement scripting logic using available element only
e. Try to avoid the code (you can use only in that case when the specific JMeter element is not available)
f. If you are writing the code logic then use Groovy instead of BeanShell.
g. Use CSV output rather than XML.
h. Save the data which you need.
i. Use as few Assertions as possible.
Q44. How to do master-slave configuration in Jmeter?


Answer:

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 is made as the Master and the others are kept as slaves by doing below configurations:
a. On master machine, edit the jmeter.properties file and add the IP addresses of slave machines against the remote_host field in the file.
b. Save the file and open the JMeter again.
c. Now from the Run menu in JMeter, select Remote Start and choose the IP of the machine to be invoked.
d. Choose the Run menu and select Remote Start all to start all the slave machines for your testing.
Q45. How sessions and cookies are managed in JMeter?


Answer:

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


HTTP Cache manager helps to cache the images and .css file. It can also be cleared after each iteration as per the requirement in the load tests and also limits the number of elements which can be stored in the cache.

Q46. What is Tidy Parsing?


Answer:

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 case of XHTML, it is mandatory to check the tidy parsing option in order to fetch the correct results.
Q47. What is heap size in jmeter?
Answer:
Jmeter is work in java, and heap size is related to java. Java heap is the heap size allocated to JVM applications which takes care of the new objects being created. If the objects being created exceed the heap size, it will throw an error of java.lang.out.of.memory.


Java’s default heap size limit in Jmeter is 256 MB.

Q48. Is it possible that, if we increase the heap size in Jmeter, then application(jmeter) might not work?

Answer:
Yes, it is possible. Because heap size depends upon the empty space of your machine in c drive as well as your RAM. If the RAM is 1 Gb and you increased the heap 2048, it may not work.

Q49. What is Response time in Jmeter report?

Answer:
Response time in Jmeter report, is the time taken by web server, to answer the requested query. In simple words, it is the time taken by a web server to respond the http request.

Q50. How did you go about fixing a performance issue?

Answer:
Set up JMeter to reproduce the production like scenario to put through concurrent requests and put the system under heavy load. Used a profiling tool to monitor CPU times, memory usage, etc.

Q51. Can we perform load testing of database with jmeter?

Answer:
Yes we can. To see the process follow: Database load testing with jmeter link. You should be aware of sql queries.

Q52. What is throughput in jmeter listener?

Answer:
Throughput is relation between time and data. It shows the relation between http request and unit time. Means how many requests are processed in how much time.


Throughput = Number of requests / Time(second or millisecond)

Q53. How to exclude timers time (think time or wait time or pause time) from the transaction response time in JMeter?
Answer:
In the transaction controller, there is one option "Include duration of timer and pre-post processors in generated sample". Un check this option, so that JMeter does not include wait time (or timer) in the sampler response time. By default, this option is unchecked.
Q54. How to remove (exclude) the response time of a sampler from a transaction response time in JMeter?
Answer:


There could be some scenarios where you want to exclude the response time of a particular sampler from the response time of a transaction controller. In JMeter, some of the samplers have flow or operational logic code written in them which should not be included in the transaction response time. JSR223 and BeanShell Samplers fall in the same category.

Q55.What drawbacks do manual load tests have?
Answer:


The manual load testing drawbacks are:

  • It is very expensive to do Manual Testing, as real users charge by the hour.
  • With manual load testing, load testing for longer durations like for 7 days won’t be possible, as users really work a maximum of eight hours daily.
  • You will not get accuracy for results correlation as there are delays between the actions of users.
  • It is hard to do results collection as the results capture each other.
  • It is hard to do.
Q56. List out what are the common performance problem does user face?
Answer:
  • Longer loading time
  • Poor response time
  • Poor Scalability
  • Bottlenecking (coding errors or hardware issues)
Q57. What would be your recommendation to improve performance measure?
Answer:


Performance improvement recommendation always depends on the nature of the bottleneck. If there is any network related issue then you can recommend to optimize the latency and bandwidth. At the database level, verify all indexes and sequences by running profilers. You may also recommend to optimize the database queries. At the App server level, run profilers for finding the memory leaks in the application. At the web server level, you can use monitors and optimize the throughput and other related metrics of the server.

Q58. What is the difference between csv data config and login config element ?
Answer:
csv data config
login config element
  1. It is used when multiple user login is required
  2. Data is stored in .txt file and path is provided in the CSV config screen in Jmeter
  3. Multiple parameters like user name, password, cookie length etc can be stored comma separated in the .txt file .
It is used when single user login is required.
Data has to be entered in Login Config Screen in Jmeter
Only 2 parameters are used in Login config i.e user name and password.

Q59. How does HTML Link Parser work?
Answer:


HTML Link Parser Pre-Processor extracts all the HTML links from the response of the previous request and then passes the random link to the successive request (under which HTML Link Parser is added as a child element).

Q60. What are the attributes of "HTML Link Parser" element?
Answer:


"HTML Link Parser" has following attributes:

Name:To provide the name of the preprocessor
Comments:To provide arbitrary comments (if any)
Q61. How to add "HTTP Cookie Manager" element?


Answer:

You can follow the below steps:
1. Select "Test Plan" node
2. Right click on "Test Plan" node


3. Mouse hovers "Add"

4. Mouse hovers "Config Element"

5. Click "HTTP Cookie Manager"

Q62. What are the attributes of "Random Variable" element?
Answer:


"Random Variable" has attributes:

Name:To provide element name
Comments:To provide arbitrary comments (if any)
Variable Name: The name of the variable to store the generated random value. The value can be called using the same variable name anywhere in the test script. Example: ${rand_Customer Id}.
Output Format:You can specify the format of the string. In the above example; if 12345 value is randomly generated then cust12345 will be the string. If nothing is specified then randomly generated value will be passed as it is.
Minimum Value:The minimum value of random number range.
Maximum Value:The maximum value of the random number range.
Seed for random function:The seed for the random number generator. The default is the current time in milliseconds. If you use the same seed value with Per Thread set to 'true', you will get the same value for each Thread.
Per Thread(User):If it is 'False', then the generated value will be shared between all threads in the thread group. If it is 'True', then each thread has its own value.
Q63. How to add "Synchronizing Timer" element?
Answer:
You can follow below steps:
1. Select "Test Plan" or "Thread Group" or "Controller" or "Sampler" node where you want to add the timer
2. Right-click on the node


3. Mouse hovers "Add"

4. Mouse hovers "Timers"

5. Click "Synchronizing Timer"

Q64. What are the attributes of "Synchronizing Timer" element?


Answer:

"Synchronizing Timer" has following attributes:
Name: To provide the name of the timer
Comments: To provide arbitrary comments (if any)
Number of Simulated Users to Group by: This attribute is used to define the number of threads to release at a time. If 0 is given then JMeter will release the same number of users which is defined in the thread group.
Timeout in milliseconds: This value helps to control the timeout of the requests during the test. If 0 (zero) is set then the timer will wait for all the threads to reach the value which is defined in "Number of Simultaneous Users to Group". If superior to 0 (zero), then the timer will wait till the number given in "Timeout in milliseconds" irrespective of thread count. If wait time exceeds the given timeout value then the users are released without meeting "Number of Simultaneous Users to Group" criteria. The default value is 0 (zero).
Q65. What is 90% line in JMeter?
Answer:
• The aggregate report listener have 90% line as one of the metric. The Apache JMeter manual describes 90% line as- "90% of the samples took no more than this time". It is actually the 90 percentile of the response times of the samples -
• 90 percentile = (90/100)*N+1/2 where N is the number of samples
• So, if there are 10 samples then 90%line will be 9.5 or 9. It means the 9th value in the sorted list of samples (sorted according to ascending order of their response times) will be the 90%line value.







No comments:

Post a Comment