Tuesday, October 28, 2014

Handling Database Requests in JMeter

When there is a need of database load testing, JMeter can play a vital role over there.. Let us see how to make a simple set up for handling database requests using the tool.

Step 1: Create a thread group under the test plan

Step 2: Begin by selecting the DB Users element. Click your right mouse button to get the Add menu, and then select Add-->Config Element-->JDBC Connection Configuration.

Set up the following fields:
  • Variable name
  • Database URL
  • JDBC Driver class
  • Username
  • Password


Rest fields can be left blank. JMeter creates a database connection pool with the configuration settings as specified in the Panel.

Step 3: Now we need to add one sampler. Selecting the DB Users element again. Click your right mouse button to get the Add menu, and then select Add --> Sampler --> JDBC Request .

Start by editing the following properties:
  • Provide the Pool Name (same as in the configuration element)
  • Enter the SQL Query String field.
  • Enter the Parameter values
  • Enter the Parameter types

Step 4: Now we need to store/view the output. This can be achieved bu use of a listener. Select the DB Users element and add a Summary Report listener ( Add --> Listener --> Summary Report ). The listener will show the result in below format.


In this way we can handle the database requests Using JMeter.

Monday, October 27, 2014

Threads in JMeter

Threads in JMeter are basically the number of virtual users. Virtual users are used to mimic the actions done by real users on the application. It can range from navigation to page, sending data via text boxes to transactions etc. It provides many options to control the threads by providing different settings. Let us see what are the options present in here. Below is the UI for a newly added thread group.


All controllers and samplers must be under a thread group in order to execute different logic as provided. Each of the thread groups runs in isolation as each one is independent of other.
Thread properties present includes:
  • Number of Threads (users)
  • Ramp-up period (in seconds)
  • Loop Count



Number of Threads (users) is the number of virtual users that would be accessing the application.

Ramp-up period is the duration in which you want the virtual users to be in your system/application.
If 5 threads are used, and the ramp-up period is 50 seconds, then JMeter will take 50 seconds to get all 5 threads up and running. Each thread will start 10 (50/5) seconds after the previous thread was begun.

Loop Count is the used to setting the number of times to execute the test. By default, the thread group is configured to loop once through its elements.

It also have a provision of decision making in case of any sampler error. One can select the various options upon failure.
  1. Continue
  2. Start next thread loop
  3. Stop thread
  4. Stop test
  5. Stop test now


Scheduler options can be viewed by clicking the check box at the bottom of the thread group panel. Here you can enter the start and end times of the run. When the test is started, JMeter will wait if necessary until the start-time has been reached. At the end of each cycle, JMeter checks if the end-time has been reached, and if so, the run is stopped, otherwise the test is allowed to continue until the iteration limit is reached.


Above are basic thread group settings that JMeter provides and can be used as per need.

Thursday, September 25, 2014

Getting started with Jmeter - Installation

Apache Jmeter is a pure Java desktop application designed to load test client/server software (such as a web application). It may be used to test performance both on static and dynamic resources such as static files, Java Servlets, CGI scripts, Java objects, databases, FTP servers, and more. JMeter can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types.


The easiest way to begin using JMeter is to first download the latest production release and install it.
You may find the link over here http://jmeter.apache.org/download_jmeter.cgi
It requires JDK 5 or higher.

Download the intended versions it can be Binaries or Source. Unzip the files to any folder.The executable script for Apache JMeter is located in the bin directory.

The executable script for Windows platform is jmeter.bat for Linux systems it will be jmeter.sh
These scripts are used to start JMeter in GUI mode. Double click the jmeter.bat script to start the tool.




You should be able to see the GUI of Jmeter.

.
Start using it!



Tuesday, September 23, 2014

Points to be taken in account while doing performance testing

Now a days every business has a face. Every business is represented by its website. Web based applications are becoming very critical to the business, if they have a very large client base or customer base which regularly access their site. In order to have a good experience to end users in timely manner , it has to be optimized.
For this to happen performance testing is done as part of non functional testing. We have some parameters for which we see the web site behavior.

  1. Responsiveness – How responsive an application is to a client request we need to check. It is about when users do some click events on page or does some navigation etc, how quickly they get back the response, that needs to optimized if it is low on it
  2. Throughput – In general it is number of units of work per unit of time. In case of web application it can be request/second or hits/second or for sales guys it can be calls/second or transactions/second etc.
  3. Reliability – It is like if at any point of time if some user access some page, it should show up the desired page. It should not show errors etc.
  4. Scalability – It may not be of that much importance but if you want to upgrade your system in order to make it handle some extra work in near future (though more resources will be added like extra memory, processors etc). It should be able to handle it without effecting the performance of web application or system

Above are some basic points that should be taken in account while going for performance testing.