Tuesday, November 29, 2011

Building a Test Plan

Now in this post we will learn how to build a test plan in JMeter, in brief.
This will be just a basic way to build a simple test plan.


Ø      Adding Elements : Right-Click on an element in the tree and choose new element from ‘Add’ list. We can also load elements from a file and add by choosing ‘merge’ or ‘open’ option.

Ø      Removing Elements : Right-Click on the element to be removed and select ‘remove’ option.

Ø      Loading Elements : To load an element from file, right click on the existing tree element to which you want to add the loaded element, and select the "merge" option. Choose the file where your elements are saved &click on ‘Open’ button. JMeter will merge the elements into the tree.

Ø      Saving Elements : Right-Click on the tree elements that you want to save and choose ‘Save Selection As ...’. JMeter will save the element selected, plus all child elements beneath it.

Ø      Configuring Elements : Any element in the test tree will present controls in JMeter's right-hand frame. These controls allow you to configure the behavior of that particular test element.

Ø      Saving the Test Plan : To save the Test Plan, select ‘Save’ or ‘Save Test Plan As ...’ from the File menu.

Ø      Running a Test Plan : To run your test plan, choose ‘Start’ from the ‘Run’ menu item. When JMeter is running, it shows a small green box at the right hand end of the section just under the menu bar. The numbers to the left of the green box are the number of active threads / total number of threads.

 This is the way we basically built a simple test plan in JMeter.
Now work it out on JMeter to know it better.

Monday, November 28, 2011

Elements of JMeter

Now we will learn what are the Elements of JMeter and why they are there in JMeter.


Elements of JMeter:


v     Test Plan
v     Thread Group
v     Controllers & Samplers
v     Listeners
v     Timers
v     Assertions
v     Configuration tool
v     Pre-processor elements
v     Post-processor elements

v     Test Plan describes a series of steps JMeter will execute when run.

v     Thread Group elements are beginning points of any Test Plan. Everything must be under Thread Group.

v     Types of Controllers:-
Ø      Samplers
Ø      Logical Controllers

Ø      Samplers tell JMeter to send a request to a server and wait for response.
                                            e.g. HTTP Request sampler.

Ø      Logical Controllers let you customize the logic that JMeter uses to decide when to send requests.

v     Listeners provide access to the information JMeter gathers about the Test cases while JMeter runs.

Ø      Graph Result Listener plots the response time on graph.
Ø      View Result Tree shows details of sampler request and response.

v     Timers are useful to specify a delay between requests send (to thread group).

v     Assertions allow you to assert facts about responses received from the server being tested. Using Assertion, you can essentially test that the application is giving result that we expect.

v     Configuration element works same as samplers but does not send request. It can modify/add requests.

v     Pre-processor executes some action prior to a sampler request being made.

Post-processor is not often used to process the response data, often to extract values from it.

I hope the above information of the elements is quite enough to start with JMeter.
Now we will get into each element, in depth, later.


Friday, November 25, 2011

Downloading & Installing JMeter on Windows

Now finally we will learn from where we should download JMeter and how to install it on your local Windows Machine.
But before that, we should know what are the basic requirements for installing JMeter and to run it on your local windows machine.


JMeter Requirements 

JMeter requires your computing environment meets some minimum requirements.

Java Version

• JMeter requires a fully compliant JVM 1.4 or higher.

• Version 2.2 and later no longer support Java 1.3.

• It is recommended to use JVM 1.5 to conduct HTTPS test with JMeter.

Operating System

• JMeter is a 100% Java application and should run correctly on any system that
has a compliant Java implementation.

• JMeter has been tested and works under:

• Unix (Solaris, Linux, Fedora etc)

• Windows (98, NT, XP, etc)

• OpenVMS Alpha 7.3+


Downloading and Installing JMeter

Jmeter is a Java application, so a JRE or SDK first needs to be installed with a JAVA_HOME environment variable.
Jmeter can be downloaded in the below link:


• Download Jmeter, and install by unzipping the .zip or .tgz file in any directory.
• Go to jakarta-jmeter Directory (Directory in which the .zip of .tgz file is unzipped)
• Type ./bin/jmeter on command prompt(for Unix) or Run bin/jmeter.bat (for Windows)
• JMeter is ready to test application.

When you run jmeter.bat file in bin directory of  jakarta-jmeter Directory, you will see the following JMeter Screen.

The user interface has two panes. The left pane displays the elements used in our testing. Initially, there are the Root and two sub-elements, Test Plan and WorkBench.
In this article we're only concerned with Test Plans. Add an element to a node by right-clicking it and selecting Add. To remove an element, select the element by clicking on it, then right-click on the element and choose the Remove option.

Test Plan: A 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 conrollers, sample generating controllers, listeners, timers, assertions, and configuration elements.

WorkBench: Workbench is place where we store test elements which are saved and used in later stages. It has two elements which are HTTP proxy server and HTTP mirror server. Http proxy server is used for recording purpose.
To use it right click on workbench  then select Add --> Non-Test Elements --> HTTP Proxy Server.

This is how we install and run JMeter in windows.
I think its quite easy to download and install JMeter and even more if you get such stuffs which does your work more simpler.


Wednesday, November 23, 2011

Performance Testing

In previous Blog Post  "JMeter Introduction" we got to know what the tool is about and why it is beneficial.
Now as we know JMeter is a performance testing tool, we should first of all know what exactly is performance testing in brief.

What is Performance Testing?


Performance testing of an application / system is basically the process of understanding how the application and its operating environment behave at various user loads. In general, it is performed by simulating virtual users to determine / validate the scalability, availability, robustness, hardware & software resource utilization of the application thus ideally paving the way for effective capacity planning of the system for future usage.
One of the main objectives of performance testing is to help maintain the system with low latency, high throughput, and low utilization.
Various types of Performance Testing include:
ØLoad Testing
ØStress Testing
ØVolume Testing
ØSpike Testing
ØEndurance Testing 

Need for Performance Testing

Performance Testing sets the ‘best possible’ performance expectation under a given configuration of infrastructure. It also highlights early in the testing process if changes need to be made before application goes into production. Some of the reasons for which Performance Testing has to be mandatorily carried out are:

P Poor Response Time : A critical webpage may take one minute to show up. The expected response time is less than 10 seconds.

P Scalability When 100 users from new branch were introduced into the system, the application was unable to handle the additional load and response times degraded from 5 seconds to 50 seconds.

P Batch Window Issues The batch upload that is supposed to happen in a 1 AM to 7 AM window does not complete till 9:30 AM. This impacts the availability of data for online applications.

P Availability The application server needs to be restarted owing to resource leaks within the application. This causes a downtime of atleast 0.5 hours a day.

P Resource Capacity Planning An application consumes 90% CPU on a server that is supposed to host another application after 3 months. There is no extra capacity to take this additional load.

Costs associated with Performance testing

Performance testing usually has huge costs associated with it. The costs associated with Performance testing can be categorized as
P The Investment made on the Performance testing tool.
P Time consumed in Preparation of test data.
P The Load Testing Infrastructure / environment setup should be as close as possible to the production environments.
P In case of administrative organizations, acquiring the required permissions is a tedious process, since performance tests typically require many administrative rights.
While there are many costs associated with Performance testing, the Investment on the tool is considered to be the most indispensable contributor to the total cost. Most of the commercial tools require separate licenses to be procured based on the user load which contributes to huge Performance testing effort cost itself.

Open Source Solution

PQuest for better alternative The Investment on the tool has lead to search out for better alternative solutions. This quest has ended in the Open Source Performance Testing tools without sacrificing quality.

PWhat is Open Source? ‘Open Source’ is defined as a software code that is available for users to examine and change freely without violating any patents, copyright laws, or licensing agreements. The idea with open source is that when everyone can work together and build upon existing tools, the ultimate result is much better software. It is a way for many companies and individuals to collaborate and improve software that each person could not do alone.

PWhy should one go for open source?

ØNo cost – Absolutely FREE!!
ØEvolving Software (Can be customized to users’ needs).
ØHigh portability.
ØScalable and offers an effective solution for growing business demands.
ØHuge open source forum technical support which stands in par with any other commercial tool support.

Well, this is what is called as performance testing. And you might have got to know even its cost effectiveness and the need in real scenario.
Now when you are getting to start with the JMeter for performance testing, we should first of all know its basic requirements of the system and how to install it on your system.
See next blog...

Monday, November 21, 2011

Introduction to JMeter


"Stefano Mazzocchi of the Apache Software Foundation was the original developer of JMeter."


Now here we will first of all learn to know about JMeter. Some basic and simple questions about JMeter.
Now hearing a word JMeter will invoke so many questions in your mind machine. So here are some common questions that a normal man would think & ask about any new thing.


What is JMeter?


• JMeter is an Apache Jakarta project that can be used as a load testing tool for analysing and measuring the performance of a variety of services, with a focus on web applications.

Apache JMeter is open source software, a 100% pure Java desktop application designed to load test functional behaviour and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

What can I do with it?

• Apache 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). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyse overall
performance under different load types.

• You can use it to make a graphical analysis of performance or to test your server/script/object behaviour under heavy concurrent load.

What does JMeter do?

Apache JMeter features include:
Can load and performance test many different server types:
Web - HTTP, HTTPS
SOAP
Database via JDBC
LDAP
JMS
Mail - POP3(S) and IMAP(S)
Complete portability and 100% Java purity .
Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
Careful GUI design allows faster operation and more precise timings.
Caching and offline analysis/replaying of test results.
Highly Extensible:
Pluggable Samplers allow unlimited testing capabilities.
Several load statistics may be chosen with pluggable timers.
Data analysis and visualization plugins allow great extendibility as well
as personalization.
Functions can be used to provide dynamic input to a test or provide
data manipulation.
Multi-platform
• Test plans can be stored in XML and can be version controlled.

Why JMeter ?

1. Zero acquisition cost — simply download the binaries from the URL.
2. Low learning curve — a basic knowledge of HTML and/or regular expressions helps
too.
3. Versatile — can be used to test more than just web applications.
4. Scalable — its modular design allows components to be merged to support largescale
testing. Testing may also be run by more than one machine.
5. Extensible — API is available for customization.
6. Good support — online user manual, user forums, web notes etc.

Now after getting some answers for some silly questions you might have understood atleast a bit of JMeter features.
That's sufficient to know about JMeter as we don't have to read a bible instead of doing it practically some new things.
Now as we got to know that JMeter can be used as a performance testing tool, it is also necessary to know what does performance testing means?
That we will go through in next post. So keep reading this Blog for new updates on JMeter.