views:

472

answers:

4

I always run autospec to run features and RSpec at the same time, but running all the features is often time-consuming on my local computer. I would run every feature before committing code.

I would like to pass the argument in autospec command. autospec doesn't obviously doesn't accept the arguments directly. Here's the output of autospec -h:

    autotest [options]

options:
    -h
    -help       You're looking at it.

    -v      Be verbose.
            Prints files that autotest doesn't know how to map to
            tests.

    -q      Be more quiet.

    -f      Fast start.
            Doesn't initially run tests at start.

I do have a cucumber.yml in config directory. I also have rerun.txt in the Rails root directory. cucumber -h gives me a lot of information about arguments.

How can I run autospec against features that are tagged as @wip? I think I can make use of config/cucumber.yml. There are profile definitions. I can run cucumber -p wip to run only @wip-tagged features, but I'd like to do this with autospec.

I would appreciate any tips for working with many spec and feature files.

A: 

Well, one tip is that you can run specs without running features, by setting AUTOFEATURE to false:

export AUTOFEATURE=false

That way you can run your specs until they are all green, then set AUTOFEATURE back to true and get your features running, and when they all pass you can get to refactoring.

zetetic
A: 

I do not run features with autotest or autospec, but instead run them manually periodically. Cucumber features are not as smart as rspec tests and will run for the smallest change. TDD is all well and good, but it's supposed to speed things up, not slow them down.

Thus, I run:

./spec/autospec

in one window, and

cucumber --tags @wip
Michael Graff
+2  A: 

If you're on OSX, you can try using the Kicker gem to launch cucumber when files change:

$ kicker -e "cucumber -p wip" .

Unfortunately, I don't know if there's a comparable program to do arbitrary file watches on windows/linux

Jamie Macey
I'm *on* OS X. Looks very promising.
TK
I like that this works for more than just wip features too. I use it with the `--tags @mytag` switch to single out particular subsets of scenarios.
phloopy
A: 

If you have an autotest profile in your cucumber.yml file, autospec will use that one instead of the default profile.

I'm using something like this to run @wip tasks:

autotest: --format pretty --tags @wip:3 --wip features

This basically says: "run first three scenarios tagged with @wip".

You could also add an autotest-all profile, if you want a different behavior from autospec when running the entire suite (normally after a red => green transition). Here's a rough example to get you started:

autotest-all: --require features --format pretty
Thanks I will try that out.
TK