Currently Browsing

JMeter

Running webdriver code in JMeter

With the improvements in technology more and more of the business logic gets executed on the client side and it’s not easy to get a clear picture of the perceivable performance by using pure JMeter tests only.
To extend these measurements JMeter-Webdriver plugin in JMeter can be handy to run WebDriver tests using actual browsers and to get client side execution statistics.

In the following section I will demonstrate how to configure and run a simple WebDriver test in JMeter.

First you have to download the plugin from the JMeter plugin page http://jmeter-plugins.org/downloads/all/ and then copy the library files into JMeter installation folder.

From now on when you start up JMeter you should have the extra Config Element and Sampler components visible on the tool list and they are ready to use

Jmeter – How to improve performance

Jmeter is a powerful load testing tool. If you are new to it you might run into some of the following problems: Out of memory error, it consumes a a lot of memory and CPU or even with a high end pc it can only work with 200 threads at the time.
Here are some tips and tricks about how can you improve the performance of Jmeter.
A simple and an important thing is to always you the latest version of Jmeter. Memory usage and performance is improved with every version so always be up to date.
The biggest error that the beginners do is the usage of listeners. Using a lot of listeners will result in out of memory since report generating takes a lot of resources. The best thing to do is to remove all the listeners. If you are asking how will you know the results then, you can use the “Simple Data Writer” to collect the results and you view the results later and generate the graphs.

If you decide to remove the listeners and go with the data writer, you need to add these lines into the user.properties file:

jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.data_type=false
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
jmeter.save.saveservice.response_data.on_error=false
jmeter.save.saveservice.response_message=false
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=false
jmeter.save.saveservice.assertions=false
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.hostname=true
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=true
jmeter.save.saveservice.response_message=false
jmeter.save.saveservice.assertion_results_failure_message=false
jmeter.save.saveservice.timestamp_format=HH:mm:ss
jmeter.save.saveservice.default_delimiter=;
jmeter.save.saveservice.print_field_names=true

Mobile Website Load Testing

Internet usage on mobile devices increases every year. Even though mobile screens became bigger, its size is still significantly smaller than PC monitors. As the result the website won’t appear correctly or the content will be too small. Because of that the websites needs to be adjusted for the current device. For this purpose there is usually created a mobile version of the website. These changes can cause different performance and stability issues. That’s why there is a need for testing on those pages as well.
There is a variety of devices and web browsers. The website to identify from what device/browser the request came from it will check the “User agent” header string which contains this information. In the later part we will show an example of the header.

For the load test we will be using JMeter. You can download the newest release from here: Download JMeter

BlazeMeter – Work with Selenium Webdriver

It was a long time we wrote about the BlazeMeter and during this time it comes more reliable, easy to use and there are also some new, great tools (Here you can find our latest post about BlazeMeter: Previous post about loadtesting with BlazeMeter).
Maybe the most important feature is that now you can use Selenium Webdriver to describe your test scenario. There are two ways of creating Selenium Webdriver test on BlazeMeter. You can write your own Selenium Webdriver script or you can record it. Unfortunately recording function was not published yet, so we will explain it in one future post (the link will be placed here).

Handling CSRF prevention tokens / dynamic data in JMeter

In today’s web technologies a common defensive mechanism against csrf attacks is to use a synchronizer token.
This token is unique for each request and thus it blocks us from using the recorded JMeter test session off the shelf.

The solution is to identify and extract the token from the html form.
Identification can be tricky as the dynamic data not always stand out in the html code.
A good practice is to record two test cases with different user credentials and compare the parameters.
Try to identify the technologies used and Google for some documentation.

Open source testing tools

There are tons of applications available for testing, some of them are free(open source), some of them are commercial. This time I have prepared a list of useful and open source testing tools.

Selenium – Web app testing tool – http://seleniumhq.org/

Selenium is a suite of tools such as Selenium IDE, Selenium Remote Control and Selenium Grid used for testing web applications. Selenium IDE is an integrated development environment for Selenium scripts. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. It supports record and playback.

Loadtesting with Blazemeter

We have finally got our hands on an interesting tool called Blazemeter. As is the case with other engineers, we are always trying to extend our knowledge. First time I heard about Blazemeter was a year ago in a seminar video, while I was trying to expand my knowledge on test recording and performance report analysis. At that time JMeter was more than enough to run our basic performance tests and based upon it’s results we were able to give good suggestions to our clients on improving their systems. As we started to test large systems we were starting to notice some weak spots of JMeter. In my opinion there are two weak spots of JMeter which slow down our work. One is the maintenance of a JMeter testing cluster. Before every testing you have to be sure that every machine is up, that all of the services are working correctly, that the network connection between the machines is ok, and of course you have to run a simple test to double check things, because sending wrong data to a client is not an option. The other thing is reporting. It’s a bit hard to create a user-friendly reports in JMeter, and usually you have to rely on an external tool to create them. As I read about Blazemeter’s function on their site I saw that Blazemeter has good scalability and nice reporting functions, and their site claims that it is an “Instant” load testing platform and you can start testing right away. We thought we should give this application a try.

Getting started with JMeter II – record traffic with Jmeter

Here will be described how to simply record traffic with Jmeter. The HTTP Proxy Server allows Jmeter to watch and record the traffic and stores them directly into the test plan.

First download and install all necessary packages:

1. Java

http://www.oracle.com/technetwork/java/javase/downloads/index.html

– After install setup the environment variables

2. Jmeter

Download Jmeter from following website, select the latest zip file:

http://jmeter.apache.org/download_jmeter.cgi

Download Jmeter

Getting started with JMeter

JMeter may be used to test performance, to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types.

First download and install all necessary packages:

1. Java

http://www.oracle.com/technetwork/java/javase/downloads/index.html
– Setup the environment variables

2. Jmeter

– Download Jmeter from following website, select the latest zip file:
http://jmeter.apache.org/download_jmeter.cgi
Jmeter download

How to integrate a JUnit4 – Webdriver test into JMeter

JMeter is an open source load testing tool, with many capabilities. One of the many interesting things which can be done is to integrate a webdriver test into a JMeter test suite.

Before start make sure that Java and JMeter properly installed, and the webdriver libraries are downloaded. You can download them from the following links:

The following step is to create a new project in Eclipse with a webdriver test. To keep it simple the test just hits the google.com page, and will check its title.

To create a project:
– Click File -> New- > Java Project

New Java Project

New Java Project

– Enter project name -> click Finish

New Java Project Name

New Java Project Name