Running specs in reverse

There is an option “–reverse” to run examples in the reverse order
which is good for detecting inter-dependencies between examples.

Is it feasible for rspec to automatically switch between “forward” and
“reverse” order each time a spec is run?

My goal is to detect inter-dependencies sooner than later…

Thanks

Alvin.

order matters - I don’t think I’ve ever used before(:all) for example.

Ashkey

Our team uses Test::Unit and numerous inter-dependencies have crept in.
Our team is also slowly moving to rspec.

Part of resolving the inter-dependencies is:

  1. education
  2. early detection

I don’t want to be the “dependency police” particularly if rspec can do
the job automatically for everyone on the team.

Alvin.

On Nov 08, 2007, at 6:07 pm, Alvin S. wrote:

My goal is to detect inter-dependencies sooner than later…

I have to say I’ve NEVER run specs backwards. Am I sitting on a time
bomb? Are there subtle traps that can create inter-dependencies
between specs? To look at my specs I would not assume that running
order matters - I don’t think I’ve ever used before(:all) for example.

Ashkey


blog @ http://aviewfromafar.net/
linked-in @ http://www.linkedin.com/in/ashleymoran
currently @ home

On Nov 11, 2007 11:01 AM, Alvin S. [email protected] wrote:

between specs? To look at my specs I would not assume that running

  1. early detection

I don’t want to be the “dependency police” particularly if rspec can do
the job automatically for everyone on the team.

Well - I don’t think rspec should do this implicitly - that might
cause quite a bit of confusion for unsuspecting devs trying to debug.

I command line arg like --toggle_reverse might work - but you’ll have
to submit a feature request in the tracker and probably a patch if you
want to see it any time soon. Very low priority on my list.

On Nov 11, 2007, at 12:47 PM, David C. wrote:

time

cause quite a bit of confusion for unsuspecting devs trying to debug.

I command line arg like --toggle_reverse might work - but you’ll have
to submit a feature request in the tracker and probably a patch if you
want to see it any time soon. Very low priority on my list.

I really like this idea, especially having had the following experience:

My coworker had no failing tests with rake spec, but I was having
failing tests with Autotest. He had introduced something into before
(:all) which stored some data into the database. Oddly enough - the
tests weren’t failing for him, although they were failing in reverse
for me- showing a dependency between the specs. The worst part is
that he was convinced this was a non-problem (because they were
passing for him).

I would implement this patch, if I had some good idea where I should
store the state of the last test run (without adding an extra text
file to my project).

Scott

On Nov 11, 2007 3:50 PM, Scott T. [email protected]
wrote:

can do

file to my project).
You’ve got to maintain state between processes. How else would you do
it besides a text file?