Using a Seperate Browser for Selenium with Cucumber

December 30th, 2009 0 Comments

If you’re using Selenium with Cucumber on a Mac you probably know that Firefox 3.5.3 is that latest version that works with Selenium. I was getting fed up with not being able to update to the latest version of Firefox so here’s what I did. Simply install Firefox 3.5.3 (the latest Selenium compatible browser at the time of this writting) and name it /Applications/Firefox-3.5.3.app

This will be the Firefox installation Selenium will use and now you’re free to upgrade your /Applications/Firefox.app install.

Now add the following code to your RAILS_ROOT/features/environments/selenium.rb file.

Webrat.configure do |config|

config.mode = :selenium

# Selenium defaults to using the selenium environment. Use the following to override this.

config.application_environment = :test

config.selenium_browser_key = *firefox /Applications/Firefox-3.5.3.app/Contents/MacOS/firefox-bin

end

Don’t forget to do this hack:

$ cd /Applications/Firefox-3.5.3.app/Contents/MacOS
$ mv libsqlite3.dylib _libsqlite3.dylib

For more help setting up Cucumber and Selenium, check my other post Setting Up Cucumber to Use Webrat and Selenium with Rails.

Fixing Airfoil Speakers for Ubuntu

December 13th, 2009 0 Comments

Airfoil is a great piece of software that I use for playing music on all the computers and iPhones in my house.  This weekend I tried to install Airfoil speakers on the Unbuntu machine in my workshop and ran into trouble.  Long story short, I needed to replace the installed DLLs with those of the Windows client.  This works because DLLS are .NET libraries and run on Mono on Ubuntu.

I’ve packaged the DLLs here so you don’t have to find a Windows machine to install Airfoil speakers on.

Setting Up Cucumber to Use Webrat and Selenium with Rails

December 8th, 2009 0 Comments

The following is the result of having to setup cucumber to use webrat and selenium twice from scratch and not finding a very good resource for doing so. I hope this can help someone else. Corrections and feedback are welcome.

Install selenium-client version 1.2.16
$ gem install selenium-client --version=1.2.16

Generate cucumber environment
$ ./script/generate cucumber

Cucumber Setup:

Use can use my cucumber_setup rails generator. It’s on github at http://github.com/kevincolyar/rails_generators and run:

$ ./script/generate cucumber_setup

and you’re done.

Otherwise, here’s how you can setup your rails environment to use both webrat and selenium with rails from scratch.

Create a cucumber.yml file in the root of your rails project containing the following:

1 default: -r features/support -r features/environments/plain.rb -r features/step_definitions features/plain
2 selenium: -r features/support -r features/environments/enhanced.rb -r features/step_definitions features/enhanced
3 autotest: -r features/support -r features/environments/plain.rb -r features/step_definitions --color --format pretty --tags ~@selenium
4 autotest-all: -r features/support -r features/environments/plain.rb -r features/step_definitions --color --format progress --tags ~@selenium
5

Create the following directories:

$ mkdir features/environments features/plain features/enhanced

Create features/environments/plain.rb containing the following:

1 #Cucumber::Rails.use_transactional_fixtures
2 #Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
3
4 Webrat.configure do |config|
5   config.mode = :rails
6 end
7 # (e.g. rescue_action_in_public / rescue_responses / rescue_from)

Create features/environments/enhanced.rb containing the following:

1
2 Webrat.configure do |config|
3 config.mode = :selenium
4 # Selenium defaults to using the selenium environment. Use the following to override this.
5 # config.application_environment = :test
6 end
7
8 # this is necessary to have webrat "wait_for" the response body to be available
9 # when writing steps that match against the response body returned by selenium
10 World(Webrat::Selenium::Matchers)
11
12 Before do
13 # truncate your tables here, since you can't use transactional fixtures*
14 end

Firefox hack:
$ cd /Applications/Firefox.app/Contents/MacOS
$ sudo mv libsqlite3.dylib _libsqlite3.dylib

If anyone knows a better fix for this please let me know.

Running Cucumber:

Now just place your webrat stories in features/plain and your selenium stories features/enhanced

To run your webrat stories, simply run:
$ cucumber

To run your selenium stories, run:
$ cucumber -p selenium

My GTD Tools

November 17th, 2009 0 Comments

The following is a list of tools that I use on a daily basis to support my way of Getting Things Done:

  • Remember the Milk – My main inbox and list manager.
  • Concentrate – My Pomodoro timer for bursts of highly concentrated work.
  • Wallet notepad and mini pen – For writing down “stuff” that comes to mind.
  • MacVim – Text Editor for editing files of projects, goals, and accomplishments.
  • Dropbox – For syncing project files and folders between multiple computers.
  • Two Tray Inbox – One tray for incoming and one for ‘to read’.
  • Pen and paper – For mind mapping and collecting.
  • Books, Blogs, and Audiobooks – For sharpening the axe.

DejaMenu

October 19th, 2009 0 Comments

Found a cool little app to help with mouse-less navigation in OSX. It’s call DejaMenu and it can be found here:

http://homepage.mac.com/khsu/DejaMenu/DejaMenu.html

It’s very simple to use. The default hot-key combination is command-shift-m to bring up DejaMenu which displays a dialog of the current apps menu bar actions. I’ve been looking for a good mouse-less way to access the menu bar. I just wish it had vi-like navigation instead of using the arrow keys.

FBI #3

September 16th, 2009 0 Comments

FYI: I’m going to start referring to From the Browser Inbox as FBI.

Mastering the Craft of Programming: The Role of Language and Agile Methods
an interview with Ward Cunningham
– A quick video.

How to Use Encrypted Disk Images – Instructions on how to create and use OSX’s encrypted disk images.  Useful for securing sensitive data.

Why You Should Switch from Subversion to Git – “I’m going to introduce you to Git, my favorite DVCS, and hopefully show you why it is not only a better version control system than Subversion, but also a revolutionary way to think about how you get your work done.”

From the Browser Inbox #2

September 15th, 2009 0 Comments

Is Your Music Still in You? – “When you don’t combine your passion with your work, it’s like putting a lawn mower engine in a Porsche.”

Top 10+ Things .NET Developers Should Know About Ruby – Nice slide deck overview of Ruby features.

The Pragmatic Bookshelf – Read Our Magazines -  Free magazines packed full of interesting articles, features, and departments.

Seasoned Ruby on Rails Developer

September 4th, 2009 0 Comments Seasoned Ruby on Rails Developer

For several years I’ve been knee deep in the entire Rails stack development.  From automated deployment with Capistrano to server administration and all the Rails coding in between.

Check out my open source Rails gems and tools on github.

From the Browser Inbox

September 3rd, 2009 0 Comments

Here’s a few better-than-most links that were thrown into my browser inbox.

HAML – “Haml is the next step in generating views in your Rails application. Haml is a refreshing take that is meant to free us from the sh*tty templating languages we have gotten used to.”

Cyclomaniacs – “Cyclomaniacs is a funny flash bike racing game with 20 different riders. Mission of the game is to unlock bikes, tracks and upgrades.”

Petabytes on a Budget – “At Backblaze, we provide unlimited storage to our customers for only $5 per month, so we had to figure out how to store hundreds of petabytes of customer data in a reliable, scalable way—and keep our costs low. After looking at several overpriced commercial solutions, we decided to build our own custom Backblaze Storage Pods: 67 terabyte 4U servers for $7,867.”

The Browser Inbox

September 3rd, 2009 1 Comments

2009-09-02_2157

Something I’ve found helpful in my pursuit to Get Things Done (GTD) was to identify an inbox for my browser.  My browser inbox is the place I throw all links that I want to either read later, move to a bookmark folder for reference, or throw into a blog post or tweet.  And just like all other inboxes in GTD, it should be processed on a regular basis in a pursuit to get to inbox-zero.