Setting up the Performance testing open source tool Grinder is pretty simple, you need to do the followings to get it on roll:
Download the Grinder and unzip in specific directory
Example directory contains few examples, you can copy the the grinder.properties file either to grinder home directory or alternatively you can create <project_name> directory in root folder and then place the grinder.properties files in it.
Update the grinder.properties files as per your need. You can refer the comments put up for each property in property file. If you need further explanation, just drop your query in comment section of this post.
You must have Java 5 or later. Set the appropriate java paths.
Create the following batch/sh files:
setGrinderEnvironment.cmd or setGrinderEnvironment.sh
@ echo off
Set GRINDERHOME=<full path to your Grinder home>
Set GRINDERPROPERTIES=%GRINDERHOME%\<path of grinder.properties
/ full path if grinder.properties file is outside grinder home>
Set CLASSPATH=%GRINDERHOME%\lib\grinder.jar;%CLASSPATH% <also set other jar files if required>
export GRINDERHOME=<full path to your grinder home>
export GRINDERPROPERTIES=$GRINDERHOME/<path of grinder.properties / full path if grinder.properties file is outside grinder home>
export CLASSPATH=$GRINDERPATH/lib/grinder.jar:$CLASSPATH <also set other jar files if required>
runConsole.cmd or runConsole.sh
call <full path of setGrinderEnvironment.cmd>
java -classpath %CLASSPATH% net.grinder.Console
. <full path to setGrinderEnvironment.sh)>
java -classpath $CLASSPATH net.grinder.Console
runProxy.cmd or runProxy.sh
call <full path to setGrinderEnvironment.cmd>
java -classpath %CLASSPATH% net.grinder.TCPProxy -console -http > <script name e.g. grinder.py>
. <path to setGrinderEnvironment.sh>
java -classpath $CLASSPATH net.grinder.Grinder $GRINDERPROPERTIES
Start the proxy using runProxy.cmd or runProxy.sh for windows and linux respectively. Set the proxy in your browser. Default proxy is localhost:80, so set the host as localhost and port as 80 in proxy settings.
Run your application, and execute the steps you would like to record. Once completed, stop the proxy by clicking the stop button of proxy console panel.
Check the grinder.py file, you can see the recorded session over here. Make sure to have the same file in grinder.properties file what you have just recorded for playback.
Start the playback session using runAgent.cmd or runAgent.sh command for windows and linux respectively.
Check the performance and errors of your playback session in logs directory (logs directory path is configured in your grinder.properties file). Data file represents test performance stats and error shows the error thrown during the test.
Emoticon Emoticon