This is more or less the perfect setup for me, and it lets us run our tests against our PHP web application using the very fast mechanize driver where possible, and for tests that require javascript we can use either the “normal” selenium driver in capybara, or send the tests off to your local grid,… Read more »
Posts Tagged: cucumber
Custom User Agent with Cucumber Tests and Webrat in Mechanize Mode
It’s pretty straightforward to set a custom user agent with mechanize if you’re using it directly, KickAssLabs has a good example. If you’re using Mechanize through Webrat though, things are a little different. The nice thing though, is that you can do this in a step definition – allowing features to be based on different… Read more »
BBC Standards Ruby Gem
Thanks to some brilliant tidying up of my work by my good friend Patrick, there is now a bbc_standards ruby gem which you can use to validate pages against some of the BBC Technical Guidelines
Using a Proxy with Cucumber, Webrat and Mechanize
If you’re writing Cucumber tests using Webrat and Mechanize to test a site, and you are behind a proxy server, you can do something like this to tell mechanize about it in your webrat_steps.rb file: When /^I am on (.+)$/ do |page_name| webrat.adapter.mechanize.set_proxy(‘proxy.host.com’,8080) visit path_to(page_name) end I’m sure there’s a tidier way to do this,… Read more »
Cucumber with Webrat and Mechanize on CentOS 5
Thanks to Chris for this one. The trick is to use JRuby and its gems, and also to install libxml2-devel $ cd ~ $ wget http://jruby.kenai.com/downloads/1.4.0/jruby-bin-1.4.0.tar.gz $ tar -C /usr/local/ -xzvf jruby-bin-1.4.0.tar.gz You should now have Jruby. Add it’s bin directory to your path, presumably in your ~/.bash_profile file: $ export PATH=$PATH:/usr/local/jruby-1.4.0/bin $ jruby -v… Read more »