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.
Sebastian W. (Guest)
on 2009-01-14 19: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
Zach D. (Guest)
on 2009-01-14 20:14
(Received via mailing list)
On Wed, Jan 14, 2009 at 12:23 PM, Sebastian W. 
<removed_email_address@domain.invalid>
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
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com
Aslak H. (Guest)
on 2009-01-14 20:29
(Received via mailing list)
On Wed, Jan 14, 2009 at 6:23 PM, Sebastian W. 
<removed_email_address@domain.invalid>
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
Scott T. (Guest)
on 2009-01-14 20: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
Sebastian W. (Guest)
on 2009-01-14 22: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. :)
Tero T. (Guest)
on 2009-01-14 23: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.  :)
Tero T. (Guest)
on 2009-01-14 23: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.
Aslak H. (Guest)
on 2009-01-14 23:50
(Received via mailing list)
On Wed, Jan 14, 2009 at 9:57 PM, Tero T. <removed_email_address@domain.invalid> 
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 ;-)
Sebastian W. (Guest)
on 2009-01-14 23:52
Aslak Hellesøy wrote:
> On Wed, Jan 14, 2009 at 9:57 PM, Tero T. <removed_email_address@domain.invalid> 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
Aslak H. (Guest)
on 2009-01-15 00:48
(Received via mailing list)
On Wed, Jan 14, 2009 at 9:55 PM, Sebastian W. 
<removed_email_address@domain.invalid>
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
Sebastian W. (Guest)
on 2009-01-15 01:04
Aslak Hellesøy wrote:
> On Wed, Jan 14, 2009 at 9:55 PM, Sebastian W. <removed_email_address@domain.invalid>
> 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
Sebastian W. (Guest)
on 2009-01-15 01: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 D. 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
Aslak H. (Guest)
on 2009-01-15 01:40
(Received via mailing list)
On Thu, Jan 15, 2009 at 12:04 AM, Sebastian W. 
<removed_email_address@domain.invalid>
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
Scott T. (Guest)
on 2009-01-15 02: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
Mark W. (Guest)
on 2009-01-15 04:03
(Received via mailing list)
On Wed, Jan 14, 2009 at 3:51 PM, Scott T. <removed_email_address@domain.invalid>
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.