Forum: RSpec IRB-like utility for Cucumber?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3da512875f3295be2d577fa70b3493b4?d=identicon&s=25 Sebastian W. (globulus)
on 2009-01-14 18:23
Hello RSpec forum,
So...I realize this is a bit of a crazy question, but I wanted to throw
it out there to see what answers came back: is there any way to start an
"interactive Cucumber" session similar to irb?

For example:
bash> crb
>> Given that I do stuff
>> When I do more stuff
>> Then stuff should happen

For each line, this imaginary "crb" utility would search some feature &
steps folders that I define somewhere, go look them up and then execute
them one by one. I was thinking it'd be kinda neat for experimenting and
playing around.

Also, I'm my own case, I'm integrating Cucumber with Selenium, so it'd
be nice to be able to drive the browser and play around as you're
writing up a feature (I was thinking the QA folks I work with would find
it pretty fun).

Is this even possible, or am I dreaming the impossible dream? What would
it take to accomplish? I'd love to contribute this if it was doable. :)

Thank you!
Sebastian
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-01-14 19:14
(Received via mailing list)
On Wed, Jan 14, 2009 at 12:23 PM, Sebastian W. <lists@ruby-forum.com>
wrote:
>
> For each line, this imaginary "crb" utility would search some feature &
> steps folders that I define somewhere, go look them up and then execute
> them one by one. I was thinking it'd be kinda neat for experimenting and
> playing around.
>

This is a very interesting idea. I like it a lot. I imagine it would
be fairly easy to write. If someone doesn't do one by this weekend I
may give it a go,

Zach


> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-01-14 19:29
(Received via mailing list)
On Wed, Jan 14, 2009 at 6:23 PM, Sebastian W. <lists@ruby-forum.com>
wrote:

>
> For each line, this imaginary "crb" utility would search some feature &
> steps folders that I define somewhere, go look them up and then execute
> them one by one. I was thinking it'd be kinda neat for experimenting and
> playing around.
>

What value vould it bring over plain old:

cucumber features/scratchpad.feature:34


> Also, I'm my own case, I'm integrating Cucumber with Selenium, so it'd
> be nice to be able to drive the browser and play around as you're
> writing up a feature (I was thinking the QA folks I work with would find
> it pretty fun).
>
> Is this even possible, or am I dreaming the impossible dream? What would
> it take to accomplish? I'd love to contribute this if it was doable. :)
>

I assume you've stumbled upon this:
http://wiki.github.com/aslakhellesoy/cucumber/sett...

Aslak
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-01-14 19:39
(Received via mailing list)
On Jan 14, 2009, at 12:23 PM, Sebastian W. wrote:

>>> When I do more stuff
> Also, I'm my own case, I'm integrating Cucumber with Selenium, so it'd
> be nice to be able to drive the browser and play around as you're
> writing up a feature (I was thinking the QA folks I work with would
> find
> it pretty fun).

Why not just start the debugger in the middle of a step definition?
(Check out the ruby-debug gem)

Scott
3da512875f3295be2d577fa70b3493b4?d=identicon&s=25 Sebastian W. (globulus)
on 2009-01-14 21:55
Aslak Hellesøy wrote:


> cucumber features/scratchpad.feature:34
>
>

Hi Aslak, I tried running this against one of my own feature files, but
it didn't seem to do anything? I wasn't sure what was supposed to
happen. Any light you can shed would be awesome. : )


> I assume you've stumbled upon this:
> http://wiki.github.com/aslakhellesoy/cucumber/sett...
>

Yes! It is awesome. Thanks a million.

For Scott: I definitely want to do the same thing with the debugger,
being able to step through the steps and so forth, but the use case for
"crb" would be just to play around and try writing expressions for fun.

E.g. if I wrote "Given that I do some step that hasn't been implemented
yet", the utility might say "=> pending" or some other message. I don't
know, color the shell yellow maybe, for the return value?

Bottom line is that this is more for fun than profit. :)
95a6493586dcb150d4fb4aec8f81b766?d=identicon&s=25 Tero Tilus (Guest)
on 2009-01-14 22:17
(Received via mailing list)
2009-01-14 18:47, aslak hellesoy:
> What value vould it bring over plain old:
> cucumber features/scratchpad.feature:34

You gotta admit that at least the cool-factor would be pretty high.  :)
95a6493586dcb150d4fb4aec8f81b766?d=identicon&s=25 Tero Tilus (Guest)
on 2009-01-14 22:41
(Received via mailing list)
2009-01-14 18:23, Sebastian W.:
> "interactive Cucumber" session similar to irb?

I can imagine it (when combined with Selenium) being not only cool,
but very useful tool when writing features.  Kinda same way console is
useful when writing code.
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-01-14 22:50
(Received via mailing list)
On Wed, Jan 14, 2009 at 9:57 PM, Tero Tilus <tero@tilus.net> wrote:

> 2009-01-14 18:47, aslak hellesoy:
> > What value vould it bring over plain old:
> > cucumber features/scratchpad.feature:34
>
> You gotta admit that at least the cool-factor would be pretty high.  :)
>

Cool is soo 2008 ;-)
3da512875f3295be2d577fa70b3493b4?d=identicon&s=25 Sebastian W. (globulus)
on 2009-01-14 22:52
Aslak Hellesøy wrote:
> On Wed, Jan 14, 2009 at 9:57 PM, Tero Tilus <tero@tilus.net> wrote:
>
>> 2009-01-14 18:47, aslak hellesoy:
>> > What value vould it bring over plain old:
>> > cucumber features/scratchpad.feature:34
>>
>> You gotta admit that at least the cool-factor would be pretty high.  :)
>>
>
> Cool is soo 2008 ;-)

But for those of us living in the US, in 2009 the slogan is "Yes, you
can!" :D
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-01-14 23:48
(Received via mailing list)
On Wed, Jan 14, 2009 at 9:55 PM, Sebastian W. <lists@ruby-forum.com>
wrote:

>
The :line suffix tells cuke to run only the scenario on that particular
line.

http://wiki.github.com/aslakhellesoy/cucumber/runn...
cucumber --help

Aslak
3da512875f3295be2d577fa70b3493b4?d=identicon&s=25 Sebastian W. (globulus)
on 2009-01-15 00:04
Aslak Hellesøy wrote:
> On Wed, Jan 14, 2009 at 9:55 PM, Sebastian W. <lists@ruby-forum.com>
> wrote:
>
>>
> The :line suffix tells cuke to run only the scenario on that particular
> line.
>
> http://wiki.github.com/aslakhellesoy/cucumber/runn...
> cucumber --help
>
> Aslak

Ah, okay - I think I understand. But couldn't I just as easily do that
with the "-s" option? When I tried running my feature with the :line
suffix it still executed everything before it, and continued going
afterwards.

For my purposes, it'd just be really nifty to play have a more
interactive environment to play around in. Again...I'm totally game for
you saying "you should get right on that, here's where to go look". :)

I'm more than willing to scratch my own itch, just not sure where to
begin. :P
3da512875f3295be2d577fa70b3493b4?d=identicon&s=25 Sebastian W. (globulus)
on 2009-01-15 00:35
Just in case it wasn't clear from my other comments, yes! Please do! :)
If there's a call for assistance, I'd love to help.

Zach Dennis wrote:

>
> This is a very interesting idea. I like it a lot. I imagine it would
> be fairly easy to write. If someone doesn't do one by this weekend I
> may give it a go,
>
> Zach
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-01-15 00:40
(Received via mailing list)
On Thu, Jan 15, 2009 at 12:04 AM, Sebastian W. <lists@ruby-forum.com>
wrote:

> >
> > Aslak
>
> Ah, okay - I think I understand. But couldn't I just as easily do that
> with the "-s" option? When I tried running my feature with the :line


The idea is to copy the last line of the backtrace of a failing
scenario. It
already has the line in the number. Copy paste is easy.


>
> suffix it still executed everything before it, and continued going
> afterwards.
>

Then you may have found a bug.


>
> For my purposes, it'd just be really nifty to play have a more
> interactive environment to play around in. Again...I'm totally game for
> you saying "you should get right on that, here's where to go look". :)
>
> I'm more than willing to scratch my own itch, just not sure where to
> begin. :P


Write scenario. Doh :-)

Aslak
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-01-15 01:16
(Received via mailing list)
On Jan 14, 2009, at 6:04 PM, Sebastian W. wrote:

>> cucumber --help
> for
> you saying "you should get right on that, here's where to go look". :)
>
> I'm more than willing to scratch my own itch, just not sure where to
> begin. :P

Yeah, just insert this into your step definition:

require 'rubygems'; require 'ruby-debug'; debugger

Then type irb <return>

Now you'll be in the middle of an IRB session

Scott
48641c4be1fbe167929fb16c9fd94990?d=identicon&s=25 Mark Wilden (Guest)
on 2009-01-15 03:03
(Received via mailing list)
On Wed, Jan 14, 2009 at 3:51 PM, Scott Taylor <scott@railsnewbie.com>
wrote:

>
> Yeah, just insert this into your step definition:
>
> require 'rubygems'; require 'ruby-debug'; debugger
>
> Then type irb <return>
>
> Now you'll be in the middle of an IRB session
>

You can actually do

~$ irb
>> require 'ruby-debug'
=> true
>> debugger
(rdb:1) irb
>>

///ark
This topic is locked and can not be replied to.