Tuesday, November 2, 2010

How to Set up The Grinder 3 for Load Testing

Basic Requirement
  1. Download and install Jython
  2. Install Jython by running this command:
    java -jar jython_installer-2.5.1.jar

How to Start The Grinder

  1. Create a grinder.properties file. (You could simply copy from grinder/examples/grinder.properties.)
  2. Set CLASSPATH to include grinder.jar
  3. Start the Console:
        java net.grinder.Console
  4. For each test machine, do Steps 1 and 2, and then start the Agent process:
        java net.grinder.Grinder [grinder.properties]
If you are getting this warning message: "can't create package cache dir", make changes to grinder.properties to look like this:
    grinder.jvm.arguments: -Dpython.cachedir=/tmp

Use command line for developing

Edit grinder.properties with these settings:
    grinder.runs = 1
    grinder.useConsole = false


To find out the default proxy settings in TCPProxy:
$ export CLASSPATH=/opt/grinder/lib/grinder.jar

$ java net.grinder.TCPProxy
12/7/10 2:02:58 PM (tcpproxy): Initialising as an HTTP/HTTPS proxy with the
   Request filters:    EchoFilter
   Response filters:   EchoFilter
   Local address:      localhost:8001
12/7/10 2:02:58 PM (tcpproxy): Engine initialised, listening on port 8001

Now, set your browser to use proxy with the above port settings.

To start the TCPProxy Console:
$ java net.grinder.TCPProxy -console -http > grinder.py