Top JMeter Testing Interview Questions & Answers
Question: What
is JMeter?
Answer:
JMeter is one of the Java tools which is used to perform load testing
client/server applications. Apache JMeter is open source software, a 100% pure
Java desktop application designed to load test functional behavior and measure
performance of the application. It was originally designed for testing Web
Applications but has since expanded to other test functions.
ร Java Based Window Application.
ร Support many type of applications like HTTP, Web
Service, LDAP, JDBC, Java, FTP etc.
ร Support Distributed Testing: So that we can distribute
load on multiple machine, so that we can simulate load on server, network or
object which are coming from different machine to implement real world
scenario.
ร Record & Playback - Record the user activity on the
browser and simulate them in web application using JMeter.
Question: What
are the protocols supported by JMeter?
Answer:
The protocols supported by JMeter are:
Web: HTTP, HTTPS sites 'web 1.0' web 2.0 (ajax, flex and flex-ws-amf)
Web Services: SOAP / XML-RPC
Database via JDBC drivers
Directory: LDAP
Messaging Oriented service via JMS
Service: POP3, IMAP, SMT P
FTP Service
Please Click on Download button to download this questions for your easy reference.
Question: List
some of the features of JMeter?
Answer:
Following are some of the features of JMeter:
ร It‟s an open source software.
ร It has simple and intuitive GUI.
ร JMeter can load and performance test many different
server types:
ร Web - HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail - POP3
ร It is platform-independent tool. On Linux/Unix, JMeter
can be invoked by clicking on JMeter shell script.
ร On Windows it can be invoked by starting the jmeter.bat
file.
ร It has full Swing and lightweight component support
(pre-compiled JAR uses packages javax.swing .* ).
ร JMeter store its test plans in XML format. This means
you can generate a test plan using a text editor.
ร It's full multi-threading framework allows concurrent
sampling by many threads and simultaneous sampling of different functions by
separate thread groups.
ร It is highly extensible.
ร Can also be used to perform automated and functional
testing of your application.
Question: Explain
how JMeter works?
Answer:
JMeter acts like a group of users sending requests to a target server.
It collects response from target server and other statistics which show the
performance of the application or server via graphs or tables.
Question: What
is a Test Plan in JMeter?
Answer:
Test Plan defines and provides a layout of how and what to test.
For example the web application as well as the client server application. It
can be viewed as a container for running tests. A complete test plan will
consist of one or more elements such as thread groups, logic controllers, sample-generating controllers, listeners, timers,
assertions, and configuration elements. A test plan must have at least one
thread group.
Question: List some of the test
plan elements in JMeter?
Answer:
Following is a list of some of the test plan elements:
ร ThreadGroup
ร Controllers
ร Listeners
ร Timers
ร Assertions
ร Configuration Elements
ร Pre-Processor Elements
ร Post-Processor Elements
Question: What is distributed load testing? How
can it be achieved in JMeter?
Answer:
Distributed load testing is the process using which multiple systems
can be used for simulating load of large number of users. The reason of using
more than one system for load testing is the limitation of single system to
generate large number of threads (users). In JMeter we can do distributed load
testing using the master slave configuration.
Question: How can we reduce the resource requirement in
JMeter?
Answer:
To make the best out of the available resources and in general as
a practice, following practices should be incorporated in the tests-
ร Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
ร Use as few Listeners as possible; if using the -l flag
as above they can all be deleted or disabled.
ร Don't use "View Results Tree" or "View
Results in Table" listeners during the load test, use them only during
scripting phase to debug your scripts.
ร Rather than using lots of similar samplers, use the same
sampler in a loop, and use variables (CSV Data Set) to vary the sample. Or
perhaps use the Access Log Sampler. [The Include Controller does not help here,
as it adds all the test elements in the file to the test plan.]
ร Don't use functional mode
ร Use CSV output rather than XML
ร Only save the data that you need
ร Use as few Assertions as possible
Please Click on Download button to download this questions for your easy reference.
Question: What
is Thread Group?
Answer:
Group elements are the beg inning points of your test plan. As
the name suggests, the thread group elements control the number of threads
JMeter will use during the test.
Thread group elements are the beginning points of any test plan.
ร 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 allow you to:
ร Set the number of threads
ร Set the ramp-up period
ร Set the number of times to execute the test
Question: What are Controllers and its types?
Answer:
JMeter has two types of
Controllers:
ร Samplers Controllers: Samplers allow JMeter to send specific types of
requests to a server. They simulate a user's request for a page from the target
server. For example, you can add a HTTP Request sampler if you need to perform
a POST, GET, DELETE on a HTTP service.
ร Logical Controllers: Logic Controllers let you control order of processing
of Samplers in a Thread. Logic Controllers can change the order of request
coming from any of their child elements. Some examples are: For Controller,
While Controller, Loop Controller, IF Controller, Run Time Controller,
Interleave Controller, Throughput Controller, Run Once Controller.
Question: What
is Work bench?
Answer:
The Workbench is simply an area to store test elements while you
are in the process of constructing a test. The Workbench is a sandbox for any
test or portion of a test that you are working on. When you are ready to test
what you have designed in the Workbench, you can copy or move the elements into
the Test Plan.
It also contains Non- Test Elements Http mirror sever Http Proxy
server {which is not available in the thread group & Test plan }
Question: What
is Configuration element?
Answer:
A configuration element works closely with a Sampler Configuration
elements can be used to set up defaults and variables for later use by
samplers.
Note that these elements are processed at the start of the scope
in which they are found, i.e. before any samplers in the same scope.
Its elements:
ร CSV Data Set Config: Used to read lines from a file, and split them 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: 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: This element lets you set default values that your HTTP
Request controllers use.
ร HTTP Header Manager: The Header Manager lets you add or override HTTP request headers
Question: What are Listeners?
Answer:
Listeners let you view the results of Samplers in the form of tables,
graphs, trees or simple text in some log files. They provide visual access to
the data gathered by JMeter about the test cases as a Sampler component of
JMeter is executed.
Listeners can be added anywhere in the test, including directly
under the test plan. They will collect data only from elements at or below
their level.
Some of the JMeter Listeners are
o
Spline Visualizer
o
Aggregate Report
o
View Result Tree
o
View Result in Table
o
Monitor Results
o
Distribution Graph
o
BeanShell Listener
o
Summary Report and so on
Question: 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 means
the regular expression matched the whole target. so alphabet‟ is “matched” by ‘al.*t.’
Question: Explain
what is timer in JMeter and what are the type’s timer in JMeter?
Answer:
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.
Question: 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
Question: Why Performance Testing is performed?
Answer:
Performance Testing is performed to evaluate application performance
under some load and stress condition. It is generally measured in terms of
response time for the user activity. It is designed to test the whole
performance of the system at high load and stress condition.
Example: Customer like to withdraw money from an ATM
counter,customer inserts debit or credit card and wait for the response. If
system takes more than 5 min. then according to requirements system functioning
is fail.
Type of Performance Testing:
ร
Load:
analogous to volume testing and determine how application deal with large
amount of data.
ร
Stress: examine application behavior under peak bursts of activity.
ร
Capacity: measure overall capacity and determine at what time response
time become unacceptable.
Question: What
are JMeter Functions?
Answer:
JMeter functions are special values that can populate fields of any
Sampler or other element in a test tree. A function call looks like this:
${__functionName(var1,var2,var3)}
Question: 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
Question: Explain
how you can capture the script of the authentication window in JMeter?
Answer:
Normally, you can capture script by recording.
o
First you have to Thread group in
Test plan and then make HTTPProxyServer in Workbench.
o
After that, set port number in
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.
Please Click on Download button to download this questions for your easy reference.