[rspec-users] How I make browser act-as-robot-driven ?

aslak hellesoy aslak.hellesoy at gmail.com
Thu May 20 16:41:50 EDT 2010


On Thu, May 20, 2010 at 10:21 PM, Chuck van der Linden <sqapro at gmail.com> wrote:
>
> On May 18, 11:08 am, Audrey A Lee <audrey.lee.is... at gmail.com> wrote:
>> Dear list,
>>
>> Today I am working through the simple tutorial here:
>>  http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails
>>
>> It has me install Cucumber-Rails and then create a feature.
>>
>> Then I watch the feature fail when I run
>> rake cucumber
>>
>> Then I watch the feature pass after I implement some code with the
>> help of:
>>
>> script/generate rspec_scaffold Frooble name:string color:string
>> description:text
>>
>> So I am happy.
>>
>> I am curious though.
>>
>> I'd like to have a browser appear and act-as-robot-driven.
>>
>> This is convenient for my development efforts.
>>
>> It allows me to rapidly create a development state inside a controller
>> and then halt the controller with a debugger statement.
>>
>> Then I attach my mind to that state and tinker with values of
>> variables and snippets of code.
>>
>> This is behavior I observed on a Rails project I wrote back in late
>> 2009.
>>
>> Back then I was using this combination of gems:
>>
>> - cucumber 0.6.x
>> - rspec-rails-1.2.9
>> - Selenium-1.1.14
>>
>> So, here is my question:
>>
>> Using this combo of gems, is it possible to have a browser appear and
>> act-as-robot-driven:
>>
>> cucumber (0.7.3)
>> cucumber-rails (0.3.1)
>> capybara (0.3.5)
>>
>> ???
>> _______________________________________________
>
> If you are looking for an easy way to 'drive' a browser with Ruby I'd
> suggest looking at WATIR (Web Application Testing In Ruby) which is
> designed for just that sort of thing.
>

I actually recommend you look at Capybara instead of Watir. It
supports all major browsers by using the rock-solid Selenium2
(WebDriver) under the hood.

Watir works too, but if you use Capybara you can use all of the
features/step_definitions/web_steps.rb out of the box.

Just add the @javascript tag above a Feature or Scenario and it should
just work.

Aslak

> I use it along with Cucumber to do regression test suites that test
> the system 'end to end'
>
> In my case I happen to use it within the Watircraft framework, just
> because it makes things a bit easier when doing a whole suite of
> tests, but for simple stuff it's probably overkill.
>
> There's also something called 'watercuke' referenced in the ccumber
> wiki (which I really don't know much about) that provides a enhanced
> level of integration..
>
> If you search the web you can perhaps also find some recordings that
> people have done at various conferences or user-group meetings where
> demo's were done of using Water and Cucumber together
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list