Entries Tagged 'Rails' ↓

Running Cucumber Tasks Through Selenium on Internet Explorer

We all need to test our code on Internet Explorer and when set up correctly, this can be the best way.

I’m not going to go over installing Ruby, MySQL (you need version 5.0), Apache etc as there are a million and one tutorials out there. I will mention however that you can save yourself some time by simply connecting to your development server (remember, you will need to open up your SQL server for remote access). I’m also not going to go over setting up selenium profiles as I’m assuming you’ve already got your tests running under a *nix environment.

Now once you’ve got your applications installed and checked out a copy of your code you need to make sure you have the right gems – exactly the same set as you needed on your development server, although I would also recommend win32console as it will give you the text colouring on your test output (and also randomly remove all of the letter As. No, really!).

Now comes the fun part. There are a series of hacks you need to do to Ruby and its gems to get them working under Windows:

  • Install MySQL 5.0 if you haven’t already and copy libmySQL.dll from the MySQL bin folder to the Ruby bin folder, overwriting the default version.
  • Change any reference to IP ‘0.0.0.0′ to ‘127.0.0.1′ in the webrat gem. This is needed because Windows will not view ‘0.0.0.0′ as localhost.
  • Add ’start’ before the ‘mongrel_rails’ command in the ’start_command’ function in ‘\selenium\application_servers\rails.rb’. This will cause the mongrel server to be run in a new console window which is needed because the mongrel *nix detach flag does not work in a Windows console.
  • Add ‘-interactive -forcedBrowserMode iexplore’ to the start command in ‘\lib\selenium\remote_control\remote_control.rb’.
  • Increase your timeouts
    • Add ‘config.selenium_browser_startup_timeout = 50′ to your selenium profile.
    • Timeouts also defined in ‘\selenium\selenium_rc_server.rb
  • Make sure you have your browser set correctly in your selenium profile with the correct path. Something along the lines of:
    • config.selenium_browser_key = ‘*iexplore C:\Program files\Internet Explorer\ie.exe’

Then run your tests and you should find your tests running quite happily.

Capistrano Continues With Help From Setfire Developer

logo-big

We’re proud to announce that as of today one of our developers, Lee Hambley has taken over maintenance of capify.org. For many people involved in Ruby on Rails development, Capistrano is a vital tool, making the whole process of maintaining production environments that much simpler, by automating and combining many of the more laborious and repetitive tasks involved.

Continue reading →