IRB-like utility for Cucumber?


#1

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. :slight_smile:

Thank you!
Sebastian


#2

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


#3

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


#4

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/setting-up-selenium

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. :slight_smile:


#5

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. :slight_smile:


#6

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. :slight_smile:

I assume you’ve stumbled upon this:
http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium

Aslak


#7

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. :slight_smile:

Cool is soo 2008 :wink:


#8

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.


#9

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. :slight_smile:

Cool is soo 2008 :wink:

But for those of us living in the US, in 2009 the slogan is “Yes, you
can!” :smiley:


#10

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/running-features
cucumber --help

Aslak


#11

Just in case it wasn’t clear from my other comments, yes! Please do! :slight_smile:
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


#12

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/running-features
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”. :slight_smile:

I’m more than willing to scratch my own itch, just not sure where to
begin. :stuck_out_tongue:


#13

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”. :slight_smile:

I’m more than willing to scratch my own itch, just not sure where to
begin. :stuck_out_tongue:

Write scenario. Doh :slight_smile:

Aslak


#14

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”. :slight_smile:

I’m more than willing to scratch my own itch, just not sure where to
begin. :stuck_out_tongue:

Yeah, just insert this into your step definition:

require ‘rubygems’; require ‘ruby-debug’; debugger

Then type irb

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

Scott


#15

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

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