rake passes but autotest fails?

| | Comments (2)

Fix Your Dependencies!!!

Yipstar finally provided me a producible test case for the situation a number of people have told me about but couldn't boil down. The whole thing is so dead simple. That is why I think I missed it this whole time:

rake:

ruby -e "require 'test_a'; require 'test_b'; ..."

autotest:

ruby -e "...; require 'test_b'; require 'test_a'"

If your tests break by simply changing the order in which they load then you have dependency issues! Every single test file you have should be able to run independently of all others (which is a damn powerful tool to have in combination with -n "/regex/").

(As an aside, I worked with yipstar and we got his tests all patched up and autotest still had a problem because it uses load, not require... no clue... Eric and I are going to look into that tomorrow)

Some of you will want me to "fix autotest"... BAH! Autotest isn't broken! Your tests are! I will add another task to Hoe that will help point out all test files that don't pass independently so you can go and patch up your tests.

% rake test_deps
Dependency Issues: test/test_a.rb
Dependency Issues: test/test_c.rb
...

We should have a release later today for both ZenTest and Hoe with new testy goodness.

2 Comments

Here's another situation to look out for...

rake test # fails autotest # passes

huh?

Well, I ran into this when one of my controllers didn't include all the fixtures I needed to make everything pass (in rake test).

So on the flip side... Fix Your Dependencies!!!

rake passes autotest fails

I ran rake test_deps and their was no output. No output is good output, right?

I'm certain I have dependency issues. But I'm having trouble figuing them out. Any tips on fixing dependcies in tests?

Jean-Charles

Leave a comment