Saturday, 6 September 2014

Using chromedriver for Selenium with Ruby

I wanted to experiment with Google Chrome webdriver instead of Firefox for my Selenium tests i write with Ruby. It went a lot smoother than i anticipated!

  1. Download the chrome driver

    As written in the documentation grab a copy of the driver that matches your OS and architechture. For example i used:

  2. Copy the binary to be on the PATH
    As this error message indicates Selenium will look for the downloaded binary on your PATH:

    Selenium::WebDriver::Error::WebDriverError: Unable to find the chromedriver executable. Please download the server from and place it somewhere on your PATH. More info at

    To resolve this i copied the file into ~/bin which is part of my PATH

  3. Change the driver in your test configuration

    Most probably you have a base test file as i do - in this file i replaced 'firefox' with 'chrome' and voila! 
      def setup
        @ops = eval('') {|f| })
        @root_host = @ops[:config_root_host]
        @sub_host = @ops[:config_sub_host]
        @driver = Selenium::WebDriver.for :chrome
As part of the experiment i first tried to enter some bogus keys instead of chrome and as expected Selenium let me know they are unknown. Whereas when i switched to chrome it warned me to put the proper chromedriver to the PATH. Ever since it works fine.

Happy testing

Saturday, 17 May 2014

Eclipse: ClassNotFoundException indicates erroneous project setup

Seems like an awful way to start the day!

Do you keep your projects / modules warning free in your IDE? As i have found out not every developer does. It starts from the beginning though. In my experience it is crucial to start off from a clean working environment in regardless of your profession. If you are working with software why not keep them tidy as if you were working with carpenter? You don't want to step into nails would you?

The screenshot i take from an example project setup (created for this very post) indicates a common issue. A library reference is out of synch in the referenced project (stub) making the other project (implementation) unable to compile.

What happened is that i altered the referenced library name from log4j-1.2.17.jar to log4j-1.2.18.jar. Then the stub project tried to warn me that there is something fishy but just as developers do regularly i ignored the warning. Then when trying to execute the test for the implementation project after some changes i cannot do so. ClassNotFoundException? This is happening because the bin folder of the implementation project vanished during a clean+build and since the referenced module cannot be built anymore my project is also not working anymore.

To my amusement developers with a couple of years of experience start to claim that the IDE is stupid because "my class is there you see? why does it say it's not there!".

Tools can be faulty i agree. But maybe we should use them well then start to make culprit of them.

Sunday, 23 February 2014

Comparing SSD with HDD

I decided to give away my 250 GB Samsung HDD to my friend as i have no real use to it anymore. We can say it has low 'milage' on it - in practice it was only used for 2 years and only during the weekends in my 'second' PC.

Before giving it to anyone of course it worth to clean it. I thought i use Ubuntu's built-in 'Disk Utility'.

When i was looking for the option to erase all content i realized this is a great opportunity to compare my 64 GB SSD (Samsung also) to this HDD. The 'Benchmark' feature offers two mode. Read-Only mode or Read/Write mode. I had to go with the first as the latter one requires an empty disk. The benchmark will give you:
  • Minimum read rate
  • Maximum read rate
  • Average read rate
  • Average access time
Of course i remembered some figures from magazines where they compared SSD to HDD respecting these attributes but i was excited to see this in action. First let's see the HDD graph:

What amazed me is the dispersion when it comes to the access time (marked as green). The average read rate was 121.2 Mb/s. Now let's see how the 'non-spinning-cousin' performed:

Note how balanced the access time graph is. Also it was measured to be around 0.2 ms. The average read rate was about 261.8 Mb/s.

I am using this small SSD in this PC for around a year and it turned out to be a great investment for me. I had issues running Java application servers for development and using the SSD i could get away with 2GB DDR2. As i only use this PC on the weekend i did not want to invest too much in DDR2 RAM which is outdated anyway. Startup time is next to nothing and i don't mind the 64 gigs of available space as this is a machine i use for work only.

What are your experiences?