strange default behavior related to rerun.txt

99 views
Skip to first unread message

drewB

unread,
Jan 29, 2010, 3:03:49 PM1/29/10
to Cukes
I just installed the latest version of cuke and wrote a feature in a
sub directory. At some point after writing step definitions, I run
cucumber from the app root and it gave me errors related to webrat
functions being undefined (e.g. undefined method `visit'). If I delete
rerun.txt and then run cucumber everything is fine.

Looking at cucumber.yml, I can see that whatever is in rerun.txt is
added to the cucumber options. In my case, "features/subdir/
create_new_program.feature:10" After doing some research I see that
had I simply run "cucumber features/subdir/create_new_program.feature:
10" it would be expected that it wouldn't find the root level support
files without me doing a require. However, this seems like very
strange behavior to happen by default.

Am I missing something?

nruth

unread,
Feb 1, 2010, 12:32:55 PM2/1/10
to Cukes
This hack worked for me: in config/cucumber.yml
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" :
"--require features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #
{rerun}"
the addition being --require features

I really like the re-run idea (it reminds me of autospec?), but it
would benefit from some documentation & either the generator amending
with the require, or someone who knows cucumber better than I do
suggesting a better solution.

On Jan 29, 8:03 pm, drewB <dbats...@gmail.com> wrote:
> I just installed the latest version of cuke and wrote a feature in a
> sub directory.  At some point after writing step definitions, I run
> cucumber from the app root and it gave me errors related to webrat

> functions being undefined (e.g. undefined method `visit'). If I deletererun.txt and then run cucumber everything is fine.
>
> Looking at cucumber.yml, I can see that whatever is inrerun.txt is

tomtt

unread,
Feb 1, 2010, 12:57:43 PM2/1/10
to Cukes
While I do like the ability to do a rerun, I do not like the behaviour
of the rerun automatically kicking in when there is a rerun.txt
present. It often confuses me and my colleagues and violates the
principle of least surprise. I think that while people are getting
used to cucumber this could easily throw them off.

By tweaking your config/cucumber.yml you can make it so that the
rerun.txt is always generated, but by default all the features are
executed. By also defining a profile that runs the features in
rerun.txt, this gives you the best of both worlds: after a failure
just run rake -p rerun to rerun only the failed features.

For example:
<%
no_rerun_opts = "--format progress features"
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
conditional_rerun_opts = rerun.to_s.strip.empty? ? no_rerun_opts :


"--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"

common_opts = "--format rerun --out rerun.txt --strict --tags ~@wip"
rerun_opts = "#{conditional_rerun_opts} #{common_opts}"
default_opts = "#{no_rerun_opts} #{common_opts}"
%>
default: <%= default_opts %>
rerun: <%= rerun_opts %>
wip: --tags @wip:3 --wip features

aslak hellesoy

unread,
Feb 1, 2010, 2:57:08 PM2/1/10
to cukes
Guys, if you want to share code, use gist, not email.

Email breaks code.

Aslak

> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>
>

tomtt

unread,
Feb 1, 2010, 3:28:48 PM2/1/10
to Cukes
> Guys, if you want to share code, use gist, not email.

Sorry. http://gist.github.com/291986

Tom

drewB

unread,
Feb 2, 2010, 3:11:49 PM2/2/10
to Cukes
Thanks for all your responses. I ended up just removing the rerun
feature. http://pastie.org/806453

Andrew Premdas

unread,
Feb 4, 2010, 7:20:24 PM2/4/10
to cu...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.

IMO (for what little that is worth :) ) the rerun behaviour is a neat trick that should be documented on the wiki, but not used as the default configuration - its too hard to understand without quite alot of cucumber knowledge, as well as being confusing in its behaviour if you are not expecting it.

Mike Sassak

unread,
Feb 4, 2010, 9:30:34 PM2/4/10
to cu...@googlegroups.com

I agree. What about a --rerun flag? Cucumber can still write out the
failing features, but will only care about its contents if run with
--rerun.

Tero Tilus

unread,
Feb 5, 2010, 1:24:51 AM2/5/10
to cukes
Mike Sassak, 2010-02-05 04:30:

> I agree. What about a --rerun flag?

I would have suggested it if you hadn't...

+1

--
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/

aslak hellesoy

unread,
Feb 5, 2010, 4:25:19 AM2/5/10
to cukes
Can someone create a ticket for --rerun please?


--

tomtt

unread,
Feb 5, 2010, 5:01:08 AM2/5/10
to Cukes
> Can someone create a ticket for --rerun please?

https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/568-rerun

Reply all
Reply to author
Forward
0 new messages