It sucks to write wrapper .rb files just so stories/all.rb can find
and run them.
So I am trawling for feedback on a small project I pushed to github a
day or two ago; it provides a ‘story’ executable that can be used to
run your plain text stories from the command line, akin to the ‘spec’
command. It’s based on Bryan H.'s script/story command that he
posted to this list – http://rubyforge.org/pipermail/rspec-users/2007-December/005194.html
– and is still pretty much all his code.
The project is available on github at GitHub - pd/story: command line runner for rspec stories and
can be installed by cloning it, rake gem, then installing the gem in
pkg/whatever.gem. I won’t be pushing a gem of this to rubyforge for a
while. The repository includes a brief readme detailing the features:
Options can be specified in stories/story.opts, which is
automatically loaded if present (unlike spec, but I am too lazy to
type -O so often)
Allows you to specify a single .story file, a directory full of
them, nothing at all to run ./stories/stories/**/*.story, etc.
It works for both rails and non-rails projects, by allowing a
–rails option to specify that stories should be run as a RailsStory
Step group definitions which should be accessible in every story can
be listed using --global-steps
Deduces the default step groups to include by using the .story
file’s pathname.
Step groups to be included which could not be deduced from the story
filename can be listed at the top of the file, eg:
+steps: foo, bar/baz, and a really long step group name
‘and a really long step group name’ is a valid name; I prefer
strings to symbols here (tho symbols will still work). This allows the
story at stories/stories/foo/bar.story to include the ‘foo/bar’ step
group, and also permits step group names such as ‘data creation’.
One achingly missing feature at the moment is hooking into the config
options for Spec::Story::Runner, but I didn’t have any immediate use
for it so I didn’t bother. But I will probably do so soon enough.
(Also, specs =)
This is very tied to the layout of my own projects, and I’d be
surprised if it works out of the box for most people. Right now it
does mostly everything I need, so I’m curious what would be necessary
to make it a viable tool for others to use.
Last one is commented out, since I just added a bunch of ajaxy stuff
to the pages and haven’t converted the stories over to ajax yet (if
that’s possible).
Each one of the steps corresponds to a controller step file that’s in
/steps. Works pretty well, not much of a hassle running stories.
This is for http://tanga.com.
Last one is commented out, since I just added a bunch of ajaxy stuff
to the pages and haven’t converted the stories over to ajax yet (if
that’s possible).
Each one of the steps corresponds to a controller step file that’s in
/steps. Works pretty well, not much of a hassle running stories.
This is for http://tanga.com.
Joe
This works for a while, and it’s what I started with. But it didn’t
scale in my experience.
Firstly, I started using the same wording for steps, but they had
different meanings by context; you can no longer just include
everything, or you can end up running the wrong step.
Moreover, one of my current suites has about 180 scenarios, which
takes a minute and a half or so to run all the way through. When I’m
working on a single feature, I don’t want to run 90% of the scenarios,
just one or two of the stories surrounding that feature. all.rb makes
that impossible, AFAIK. So you start writing individual .rb files you
can run separately, which all.rb just sources. I ended up spending a
lot of time managing the infrastructure instead of getting work done.
brynary’s script/story relieved that headache for me.
This is very tied to the layout of my own projects, and I’d be
surprised if it works out of the box for most people. Right now it
does mostly everything I need, so I’m curious what would be necessary
to make it a viable tool for others to use.
Hi Kyle
Worked great out of the box for my little migration tool and its one
story I will be able to provide better feedback when I’ve got more
functionality under test, only spent a day on this project so far.
Thanks for assembling the story command in a tidy package