Skip to main content

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 __call__(self):
        # Per thread scripting goes here.
        grinder.getLogger().output("Hello World")

Next I need to add a grinder.properties to the directory as well:
grinder.processes = 1
grinder.threads = 1
grinder.runs = 1
grinder.useConsole = false
grinder.logDirectory = logs
grinder.numberOfOldLogs = 0
grinder.initialSleepTime=50
I can now select my HelloGrinder.py file, and with right mouse button select: Run As -  Grinder Run.
Logs will appear under src. You will need to click refresh (F5) on you project before they get visible ..

Output looks like:
02.06.10 16:27:18 (process emeafralp560-0): The Grinder version 3.4
02.06.10 16:27:18 (process emeafralp560-0): Java(TM) 2 Runtime Environment, Standard Edition 1.5.0_06-b05: Java HotSpot(TM) Client VM (1.5.0_06-b05, mixed mode) on Windows XP x86 5.1
02.06.10 16:27:18 (process emeafralp560-0): time zone is CEST (+0200)
02.06.10 16:27:20 (process emeafralp560-0): worker process 0
02.06.10 16:27:20 (process emeafralp560-0): Java VM does not support instrumentation, DCR unavailable
02.06.10 16:27:20 (process emeafralp560-0): instrumentation agents: NO INSTRUMENTER COULD BE LOADED
02.06.10 16:27:20 (process emeafralp560-0): executing "C:\Dokumente und Einstellungen\jan.kester\workspace\Grinder1\src\HelloGrinder.py" using Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)]
02.06.10 16:27:20 (process emeafralp560-0): starting threads
02.06.10 16:27:20 (thread 0): starting, will do 1 run
02.06.10 16:27:20 (process emeafralp560-0): start time is 1275488840962 ms since Epoch
02.06.10 16:27:20 (thread 0): sleeping for 38 ms
02.06.10 16:27:20 (thread 0 run 0): Hello World
02.06.10 16:27:20 (thread 0): finished 1 run
02.06.10 16:27:20 (process emeafralp560-0): elapsed time is 58 ms
02.06.10 16:27:20 (process emeafralp560-0): Final statistics for this process:
             Tests        Errors       Mean Test    Test Time    TPS         
                                       Time (ms)    Standard                 
                                                    Deviation                
                                                    (ms)                     


Totals       0            0            ?            0,00         ?           

  Tests resulting in error only contribute to the Errors column.         
  Statistics for individual tests can be found in the data file, including
  (possibly incomplete) statistics for erroneous tests. Composite tests  
  are marked with () and not included in the totals.                     
02.06.10 16:27:20 (process emeafralp560-0): finished




Comments

Popular posts from this blog

SSL handshake failed: Secure connection truncated

Got this problem on Ubuntu 9.10 and 10.10. svn co --username=xx https:/yy zz “SSL handshake failed: Secure connection truncated” According to this link bug-ubuntu The solution is: sudo apt-get install libneon27 cd /usr/lib/ sudo rm libneon-gnutls.so.27 sudo ln -s /usr/lib/libneon.so.27 libneon-gnutls.so.27

Junit4 running parallel junit classes

To run junit testcases parallel, you can create your own class to run junit with: Add this tag to your class declaration. @RunWith(Parallelized.class) Implementation of this class looks like: package mypackage; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.junit.runners.Parameterized; import org.junit.runners.model.RunnerScheduler; public class Parallelized extends Parameterized {         private static class ThreadPoolScheduler implements RunnerScheduler     {         private ExecutorService executor;                 public ThreadPoolScheduler()         {             String threads = System.getProperty("junit.parallel.threads", "16");    ...

Interactive selenium testing

The problem Location of elements When I started using selenium, I noticed that it is not easy to do it right. First you start with IDE, but you notice, that the IDE does not really record a lot. In a next step I added firebug, and started analyzing how the elements where to be located: either by tag, id, class etc. Junit testcase With this information I could then create my junit testcase: @Test public void testMapView() throws Exception { //assert that we cannot see submenu of MapCreator elem = driver.findElement(By.className(SeleniumConstants.MAP_SUB_MENU)); String style = elem.getAttribute("style"); assertTrue("Element must have style display off.",style.matches("display: none.*")); logger.debug("Located element " + SeleniumConstants.MAP_SUB_MENU); //find menu and click on mapview elem = driver.findElement(By.id(SeleniumConstants.MAP_CONTROL)); actions.moveToElement(elem).click().perform(); //assert su...