JMeter Interview Questions and Answers, Performance Test Tools, JMeter Installation, JMeter Test Plan, Components of Test Plan, and Analyze Test Results.
Apache JMeter Interview Questions and Answers
1) What is JMeter?
JMeter is a Performance Test Tool, other test tools for performance testing are, Micro Focus LoadRunner, IBM RPT, SilkPerformer, WebLoad, NeoLoad, OpenSTA etc…
Performance Testing is a non functional test type,
Load Testing, Stress Testing, Spike Testing, Endurance Testing and Volume Testing are the subsets of Performance Testing.
‘Apache JMeter’ is an open source, 100% Java based application with a graphical user interface. It is designed to analyse and measure the performance and load functional behaviour of web application and variety of services.
JMeter is mainly used for testing Web application or FTP application but currently, it is applicable in functional testing, JDBC database connections, Web services, generic TCP connections and OS native processes. You can perform various testing activities like Performance, Load, Stress, Regression and Functional testing, in order to get accurate performance metrics against your web server.
JMeter was originally written and developed by Stefano Mazzocchi of the Apache Software Foundation. It was primarily written to test the performance of Apache JServ(currently known as Apache Tomcat project).Apache redesigned JMeter to enhance the GUI, to add more features and functional testing capabilities.
JMeter is not a browser and it doesn’t render html pages like any browser does, rather it works on protocol level.
2) What are the Features of JMeter?
Some of the most important features of JMeter are listed below:
> Open source application: JMeter is a free open source application which facilitatesusers or developers to use thesource code for developmentof other applications.
> User-friendly GUI: JMeter comes with simple and interactive GUI.
> Support various testing approach: JMeter supports various testing approach like Load Testing, Distributed Testing, and Functional Testing, etc.
> Platform independent: JMeter is written and developed using java, so it can run on any environment / workstation that accepts a Java virtual machine, for example – Windows, Linux, Mac, etc.
> Support various server types: JMeter is highly extensible and capable to load the performance test in different server types:
Web: HTTP, HTTPS, SOAP,
Database: JDBC, LDAP, JMS, and
> Support multi-protocol: JMeter supports protocols such as HTTP, JDBC, LDAP, SOAP, JMS, and FTP.
> Simulation: JMeter can simulate multiple users by using virtual users or unique users in order to generate heavy load against web application under test.
> Framework: JMeter is a multi-threading framework which allows concurrent and simultaneous sampling of different functions by many or separate thread groups.
> Remote distributed testing: JMeter has Master-Slave concept for distributed testing where master will distribute tests among all slaves and slaves will execute scripts against your server.
> Test result visualization: Test results can be viewed in different formats like graph, table, tree, and report etc.
3) Name The Protocols Supported By JMeter?
Following are some of the protocols supported by JMeter.
i. Web Protocol: To test the web applications, it supports both HTTP and HTTPS protocols.
ii. Web Services: To test web services applications, it supports both SOAP and REST.
iii. FTP: File Transfer Protocol provides the support for testing the FTP servers and applications.
iv. Database via JDBC: used for testing the database applications.
v. LDAP: Lightweight Directory Access Protocol
vi. Message-oriented middleware (MOM) via JMS
vii. Mail: used for testing of mail servers such as SMTP(S), POP3(S) and IMAP(S)
viii. MongoDB (NoSQL): it is recently supported protocol by JMeter.
ix. Native commands or shell scripts
4) How to Install JMeter?
JMeter is a pure Java application and should run correctly on any system that has a compatible Java implementation.
JMeter supports various Operating Environments:
Step 1) Install Java
Because JMeter is a pure Java desktop application, it requires a fully compliant JVM. You can download and install the latest version of Java Development Kit.
After installation is finished, you can use the following procedure to check whether Java JDK is installed successfully in your system
In Window/Linux, go to Terminal
Enter command java -version
Step 2) Download Jmeter
Step 3) Installation
Installation of JMeter is extremely easy and simple. You simply unzip the zip/tar file into the directory where you want JMeter to be installed. There is no tedious installation screen to deal with! Simply unzip and you are done!
Step 4) Launch JMeter
You can start JMeter in 3 modes
Command Line Mode
Start JMeter in GUI Mode
If you are using Window, just run the file /bin/jmeter.bat to start JMeter in GUI mode
5) 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.
6) 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 of one or more of the following elements.
vi. Configuration Elements
vii. Pre-Processor Elements
viii. Post-Processor Elements
A Test Plan should have at least one thread group.
7) What are Regular Expressions in JMeter?
Regular Expressions are used to search and manipulate text. JMeter is used for interpreting forms of regular expression or patterns being used throughout a JMeter test plan.
8) What is the Execution Order of Test Elements?
The execution order of Test Elements is in the following sequence:
Post-Processors (unless SampleResult is null)
Assertions (unless SampleResult is null)
Listeners (unless SampleResult is null)
9) What are Samplers?
Samplers – Sampler generates one or more sample results. These sample results have many attributes like elapsed time, data size, etc. It allows JMeter to send specific types of requests to the server, through samplers, thread group decides which type of request it need to make. Some of the useful samplers are HTTP request, FTP request, JDBC request etc.
10) What are Thread Groups?
Thread Group is an important element of JMeter, where you can set number of users and time to load all the users given in the thread group.
A Test Plan should have at least one thread group.
11) What is a Timer in JMeter? What are the types of it?
A JMeter thread by default will send requests continuously without any pause. Timers are used to get a pause between the request.
The different types of Timer in JMeter are:
Constant Timer – This element delays each request in a Thread Group for the same amount of time.
Gaussian Timer – This element is used to delay each user request for a random period of time.
Synchronizing Timer – This element is used to release number of threads at given point.
Uniform Random Timer – This element is used to delay each request for a random period of time.
12) What is Assertion in JMeter? List the types of Assertion.
Assertion helps to verify that your server under test returns the expected results.
The Types of Assertion include:
Response Assertion – It facilitates the user by comparing the server response against a string pattern to check that the result is as expected.
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.
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.
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.
13) What are Configuration Elements?
Configuration Elements help you to create defaults and variables to be used by Samplers. They are also used to add or modify requests made by Samplers. These elements are executed at the start of the scope of which they are part. Therefore, a Configuration Element is accessed only from inside the branch where it is placed.
14) How to reduce the resource requirement in JMeter?
To reduce the resource requirements in JMeter:
> Use non-GUI mode.
> During the load, test doesn’t use “view results tree” or “view results in table” listeners. It is used only during scripting phase.
> Don’t use functional mode.
> Do not use similar samplers. Instead, use the same sampler in loop and use variable to vary the sample.
15) What is Distributed Load Testing & how to achieve it?
Distributed load testing is the process through which numerous systems can be used for simulating a load of a large number of users. JMeter can do distribute load testing with the help of master-slave configuration.
16) What is the use of co-relation in JMeter?
Co-relation is a process in which values can be extracted from the server response and stored in a variable and then can be used in any other request which is to follow.
For Example, for testing any login functionality if you have to use session ID/cookie ID , you can extract the value from the response of GET request of the login page and then dynamically use the same while making POST request for login.
17) 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. Mobile and Jmeter should be on the same network.
18) Do we use Variables and Functions in JMeter?
Just as in any other programming language, variables and functions are used in Jmeter also in order to make the scripts reusable.
19) 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, Webdriver sampler plugin can be added in the JMeter ext folder and then restart the Jmeter. Write your selenium code in the Webdriver sampler and then execute to see the performance.
20) 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 release them all together thus creating large instantaneous load.