Tuesday, July 3, 2012

JMeter Interview Questions and Answers


Q1 . Does Jmeter generate any scripts? How to use the Jmeter tool and also the How to analyze the results?

A1.When you create a test in Jmeter, save the file. The file saves with the extension .jmx.
Open the .jmx file in an editor. There you can see script.
Q2. For what purpose are Junit and Jmeter used?

A2.Jmeter is a Performance Tool. It is used to test the performance of the application. Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

What is Jmeter?
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

what are the other applications tested by Jmeter? 
JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more)

What do u see when u open a jmeter?
By default,
Test Plan
Workbench
can be seen

What is Test Plan in Jmeter?
Test plan describes a series of steps JMeter will execute when run.
A complete test plan will consist of one or more Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.

What is Work bench?
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 


What is Thread Group?
Thread group elements are the beginning points of any test plan.

  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 allow you to:
  • Set the number of threads
  • Set the ramp-up period
  • Set the number of times to execute the test 
What are the parts of thread group?

  • Sampler :Sends various types of requests to the server
  • Listeners : Results of the Run can be viewed & saved
  • Timer : Makes the run more realistic by inserting delays between the requests
  • Controller: responsible for controlling the flow of the thread group. If we have defined request to be executed on some logic like if-then-else or loop structure in java
  • Config Element: Info about the requests are added to work with samplers using this.
  • Assertion: To check if the responses are within given time and containing expected data
What are Controllers and its types? 
JMeter has two types of Controllers

Samplers Controllers 
Logical Controllers 

Samplers Controllers 
Samplers tell JMeter to send requests to a server.
For example, add an HTTP Request Sampler if you want JMeter to send an HTTP request. You can also customize a request by adding one or more Configuration Elements to a Sampler.

Logical Controllers 

Logical Controllers let you customize the logic that JMeter uses to decide when to send requests.
Logic Controllers can change the order of requests coming from their child elements.
For example, you can add an Interleave Logic Controller to alternate between two HTTP Request Samplers.

What is Configuration element?

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:  
  1. It stores and sends cookies just like a web browser.
  2. 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




What are Listeners?
A listener is a component that shows the results of the samples
the results can be shown in a tree, tables, graphs or simply written to a log file

The Graph Results listener plots the response times on a graph.
The "View Results Tree" Listener shows details of sampler requests and responses, and can display basic HTML and XML representations of the response.
Other listeners provide summary or aggregation information.

Every listener in JMeter provides a field to indicate the file to store data to.
They also provide means to view, save, and read saved test results.

Q. How do you ensure re-usability  in your JMeter scripts?
A.
 · Using config elements like "CSV Data Set Config", "User Defined Variables", etc for greater data reuse
·    Modularizing shared tasks and invoking them via a "Module Controller".
·  Writing your own BeanShell functions, and reusing them.
Does Jmeter generate any scripts? How to use the Jmeter tool and also the How to analyze the results?
When you create a test in Jmeter, save the file. The file saves with the extension .jmx.
Open the .jmx file in an editor. There you can see script.

For what purpose Jmeter used?
Jmeter is a Performance Tool. It is used to test the performance of the application. Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Can we Parametrize via Jmeter?
Yes, you can parametrize via CSV file, User define variables or XML sheet.



Reference Site----

http://java-success.blogspot.in/2011/10/jmeter-interview-questions-and-answers.html

2 comments:

Krishna GM said...

Very clear to under stand jmeter..
i will hope to u more post ..Jmeter or performance testing..

can u send more doc?
Vigneshmanage@gmail.com

Thanks!!!

Unknown said...

This article is very fruitful. Thanx for sharing the information about Uses of Controllers in JMeter