Skip to main content

Posts

Showing posts from June, 2010

Grinderstone under linux

I am using Ubuntu 9.10 jan@albotek:~/development/eclipse$ more /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=9.10 DISTRIB_CODENAME=karmic DISTRIB_DESCRIPTION="Ubuntu 9.10" I installed new eclipse 3.5.2, and inside eclipse used jdk 1.6.0.20 as default JRE, and jython 2.5.1 for my jython. Still I did not manage to get my grinder scripts with proxy working. The failure I was getting: Java exception initialising test script test1.record(grinder.getLogger().output) File "/home/jan/development/workspace-grinder/Grinder1/src/HelloWorld3.py", line 7, in Caused by: net.grinder.script.NonInstrumentableTypeException: Failed to wrap at net.grinder.engine.process.instrumenter.MasterInstrumenter.instrument(MasterInstrumenter.java:114) at net.grinder.engine.process.TestData.instrument(TestData.java:100) at net.grinder.script.Test.record(Test.java:114) In my output log I was seeing: 6/5/10 10:22:09 a.m. (process albotek-0): The Grinder version 3.4 6/5/10 10:2...

Grinderstone and instrumentation

At least I got my office PC (windows) working now. Script is: # A simple example using the HTTP plugin that shows the retrieval of a # single page via HTTP. 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 used to get failures that had to do with instrumentation. In the end I added a new jdk6 (1.6.0.20) to eclipse, renewed my jython 2.5.1 reference so that it is using these libs, and now got it working. In my console I see the following path: 04.06.10 17:03:42 (agent): The Grinder 3.4 04.06.10 17:03:42 (agent): Worker process command line: java '-javaagent:C:\development\grinder-3.4\lib\grinder-agent.jar' -classpath 'C:\development\jython2.5.1\jython.jar;C:\Dokumente und Einstellungen\jan.keste...

record() not wrap()

With the new jython 2.5.1 instrumentation, you must use record() method of Test proxy, and not wrap(). The old one is deprecated. The difference: old: 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") new: from net.grinder.script import Test from net.grinder.script.Grinder import grinder test1 = Test(1, "Log method") # Instrument the output() method with our Test. test1.record(grinder.getLogger().output) class TestRunner: def __call__(self): grinder.getLogger().output("Hello World4")

Using grinder 3.4 and jython 2.5.1

By default grinder 3.4 comes with a jython jar under lib directory. It is version 2.2.1. In order two use a newer jython, you need to change two settings: add your newest jython jar in front of classpath add a jvm property that directs python_home to the home of your jython. You can either do this in grinder.properties or in your bat script that starts the agent. I prefer the latter as I would like to keep grinder.properties as general as possible, independent of machines/environment. My new startAgent_jython251.cmd script looks like: @echo off set GRINDERPATH=C:\development\grinder-3.4 call %GRINDERPATH%\setGrinderEnv.cmd set PYTHON_HOME=C:/development/jython2.5.1 echo %CLASSPATH% set CLASSPATH=%PYTHON_HOME%/jython.jar;%CLASSPATH% set JVMARGS="-Dpython.home=%PYTHON_HOME% -Dpython.cachedir=%GRINDERPATH%/cachedir" java -Duser.language="en" -Dgrinder.jvm.arguments=%JVMARGS% -cp %CLASSPATH% net.grinder.Grinder %GRINDERPROPERTIES% When I run a script with this...

My first grinder runs

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.py startConsole.cmd set GRINDERPATH=C:\development\grinder-3.4 call %GRINDERPATH%\setGrinderEnv.cmd echo %CLASSPATH% java -Duser.language="en" -cp %CLASSPATH% net.grinder.Console startAgent.cmd set GRINDERPATH=C:\development\grinder-3.4 call %GRINDERPATH%\setGrinderEnv.cmd echo %CLASSPATH% java -Duser.language="en" -cp %CLASSPATH% net.grinder.Grin...

Adding your own styles

To get nice formatting of your blog, you can add your own style elements. Under Customize - Layout - Edit Html you can adapt your style sheet. Find the element: ]]></b:skin> </head> and above this add: pre { background:#eeeeee; border:1px solid #A6B0BF; font-size:120%; line-height:100%; overflow:auto; padding:10px; color:#000000 } pre:hover { border:1px solid #efefef; } code { font-size:120%; text-align:left; margin:0;padding:0; color: #000000;} .clear { clear:both; overflow:hidden; } Now you have two new styles you can use: pre and code. To use them, switch to Edit HTML mode, and use html tags pre or code.

My first grinderstone project

I followed instructions to set up grinderstone: eclipse 3.5.2  pydev from update site  grinderstone from update site jython 2.5.1 installed grinder 3.4 installed Under windows preferences I added a jython 2.5.1 jar as jython interpreter. It asks which libraries to include on the python system path. I choose the defaults, excluding __pyclasspath__ and __classpath__. Not sure where these get used for; probably to include your project's  .classpath or python path in the jython execution's classpath. Also under windows-preferences, I set show whitespace characters to true. Next I create a python project. I added grinder.jar and grinder-agent.jar to the external libraries of the project build path. Now I can add my first grinder file under src/HelloGrinder.py: from net.grinder.script.Grinder import grinder # An instance of this class is created for every thread. class TestRunner:     # This method is called for every run.     def...