Category Archives: load test

How to use Grinder load testing framework as a developer

Reading Time: 2 minutes

TL;DR

Here I will try to get your feet wet with grinder load testing framework. The fact: using grinder you will produce better code. Period.

 

My first contact with grinder was in 2005 with grinder 3.2. Somewhere at that time I started to learn python language which was important because grinder scripts are written in Jython, a Java implementation of Python language. In order to know what is grinder intended for,you have a lot of information on project home page.

It is a load testing framework. So, my first intention was to create a heavy load on J2EE application that I was testing. As I was getting along (in a system end-to-end tester role) with Jython and grinder environment, an idea about grinder primary usage for developers pop upped to me.

 

As my college and me were discussing a module implementation, important question pop upped: “How this module is going to behave when deployed on J2EE application server?” We knew that J2EE application server was multithreading environment. We need to deploy application on application server, and create application that will simulate user load. My college said: “But I need to know that information tomorrow, not for two months! Also, I would like to have ability to run those multi user tests on my laptop, as close as possible to Junit framework environment!

 

At that time I was developing Jython testing script using grinder framework for creating load (concurrent) test for our J2EE system, so I was a developer to. And I knew that Grinder gives a developer infrastructure to put into multi user environment Java code that he/she is developing! By users I mean threads or processes.

For example, my testing script needed to write xml message request a to a file.

Using grinder infrastructure,my testing script generated multi user requests for writing to that file. I was in multi user environment even before I got a chance to get to the server side code. And because I didn’t use grinder api for accessing file streams (yes, one of the reason that grinder was created was to provide that kind of infrastructure writeToFile method example) I got Java exception.

If you are developing some system module and you write unit test for classes of that module, every time you are ruining your test in single user environment!

In production (e.g. J2EE application server) your module will be definitely in multi user environment. Using grinder, you are able to create multi user environment for your module on your local development machine. You system tester would be very grateful for that!

 

In following posts I will try to give how-tos for grinder setting up. Also I will give an example on one simple module how can grinder help you to reveal multi user bugs and problems.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather