I downloaded grinder 3.4, and unpacked.
I installed java jdk 1.6.0.20 on my machine.
Inside the root directory of my installation I added following scripts:
setGrinderEnv.cmd
set GRINDERPATH=C:\development\grinder-3.4 set GRINDERPROPERTIES=C:\development\grinder-3.4\grinder.properties set CLASSPATH=%GRINDERPATH%\lib\grinder.jar;%CLASSPATH% set JAVA_HOME=C:\Programme\Java\jdk1.6.0_20 PATH=%JAVA_HOME%\bin;%PATH%startProxy.cmd
set GRINDERPATH=C:\development\grinder-3.4 call %GRINDERPATH%\setGrinderEnv.cmd echo %CLASSPATH% java -Duser.language="en" -cp %CLASSPATH% net.grinder.TCPProxy -console -http > ipp.pystartConsole.cmd
set GRINDERPATH=C:\development\grinder-3.4 call %GRINDERPATH%\setGrinderEnv.cmd echo %CLASSPATH% java -Duser.language="en" -cp %CLASSPATH% net.grinder.ConsolestartAgent.cmd
set GRINDERPATH=C:\development\grinder-3.4 call %GRINDERPATH%\setGrinderEnv.cmd echo %CLASSPATH% java -Duser.language="en" -cp %CLASSPATH% net.grinder.Grinder %GRINDERPROPERTIES%I also dropped a file grinder.properties in root directory of grinder-3.4:
grinder.script=HelloGrinder2.py grinder.processes = 1 grinder.threads = 3 grinder.runs = 2 grinder.useConsole = false grinder.dcrinstrumentation = true grinder.logDirectory = logs grinder.numberOfOldLogs = 0 grinder.initialSleepTime=50With this grinder.properties, an agent will execute the HelloGrinder2.py script:
from net.grinder.script import Test from net.grinder.script.Grinder import grinder test1 = Test(1, "Log method") # Wrap the output() method with our Test and call the result logWrapper. logWrapper = test1.wrap(grinder.getLogger().output) class TestRunner: def __call__(self): logWrapper("Hello World2")I can execute the script by calling startAgent.cmd. After execution I get a subdirectory called log, with data and output files in it. The output file shows:
04.06.10 10:47:40 (process emeafralp560-0): starting threads 04.06.10 10:47:40 (thread 2): starting, will do 2 runs 04.06.10 10:47:40 (thread 1): starting, will do 2 runs 04.06.10 10:47:40 (thread 0): starting, will do 2 runs 04.06.10 10:47:40 (process emeafralp560-0): start time is 1275641260135 ms since Epoch 04.06.10 10:47:40 (thread 0): sleeping for 10 ms 04.06.10 10:47:40 (thread 1): sleeping for 1 ms 04.06.10 10:47:40 (thread 2): sleeping for 4 ms 04.06.10 10:47:40 (thread 2 run 0 test 1): Hello World2 04.06.10 10:47:40 (thread 1 run 0 test 1): Hello World2 04.06.10 10:47:40 (thread 0 run 0 test 1): Hello World2 04.06.10 10:47:40 (thread 1 run 1 test 1): Hello World2 04.06.10 10:47:40 (thread 1 test 1): finished 2 runs 04.06.10 10:47:40 (thread 0 run 1 test 1): Hello World2 04.06.10 10:47:40 (thread 0 test 1): finished 2 runs 04.06.10 10:47:40 (thread 2 run 1 test 1): Hello World2 04.06.10 10:47:40 (thread 2 test 1): finished 2 runs 04.06.10 10:47:40 (process emeafralp560-0): elapsed time is 22 msAs my grinder properties file tells to use 3 threads, and 2 runs for each thread, the Hello World2 got written 6 times. My data output shows the test times that the Test Proxy of the script recorded:
Thread, Run, Test, Start time (ms since Epoch), Test time, Errors 0, 0, 1, 1275641260152, 0, 0 1, 0, 1, 1275641260152, 0, 0 2, 0, 1, 1275641260152, 1, 0 1, 1, 1, 1275641260153, 0, 0 0, 1, 1, 1275641260154, 0, 0 2, 1, 1, 1275641260154, 0, 0This output is a bit boring, as I did not make any http request. With the next file HelloGrinder3.py I do:
from net.grinder.script import Test from net.grinder.script.Grinder import grinder from net.grinder.plugin.http import HTTPRequest test1 = Test(1, "Request resource") request1 = test1.wrap(HTTPRequest()) class TestRunner: def __call__(self): result = request1.GET("http://emeafraippqa08:80/")I need to adapt grinder.properties to use this as grinder.script, and then can run startAgent.cmd again. Now my data output looks like:
Thread, Run, Test, Start time (ms since Epoch), Test time, Errors, HTTP response code, HTTP response length, HTTP response errors, Time to resolve host, Time to establish connection, Time to first byte 1, 0, 1, 1275650338473, 60, 0, 200, 327, 0, 23, 33, 50 1, 1, 1, 1275650338535, 2, 0, 200, 327, 0, 0, 0, 1 2, 0, 1, 1275650338473, 3105, 0, 200, 327, 0, 22, 3085, 3094 0, 0, 1, 1275650338481, 3097, 0, 200, 327, 0, 23, 3085, 3094 2, 1, 1, 1275650341579, 5, 0, 200, 327, 0, 0, 1, 3 0, 1, 1, 1275650341579, 7, 0, 200, 327, 0, 0, 1, 2
Comments