ZenTest autotest problems

Z

Zouplaz

Hello, I have big troubles using the latest autotest version (3.4.2)

My current project passes all the tests under the 3.3.0 version but I
get dozens of assertion errors with the 3.4.2

What's wrong ?

Is there something special to do on the project configuration or test
scripts (I hope no) except executing autotest ?

I've tried to find some info in the doc
(http://zentest.rubyforge.org/ZenTest/) without success

Thanks
 
E

Eric Hodel

Hello, I have big troubles using the latest autotest version (3.4.2)

My current project passes all the tests under the 3.3.0 version but
I get dozens of assertion errors with the 3.4.2

What's wrong ?

Using my intensely powerful mind-reading psychic skills, I'll have to
say that you forgot to sacrifice a goat.

Sacrifice a goat and that should fix it. In fact, two wouldn't hurt.
Is there something special to do on the project configuration or
test scripts (I hope no) except executing autotest ?

Hrm, on second thought you could post some information about what
failures you're getting with autotest 3.4.2 vs 3.3.0. Or perhaps
even file a bug with all this information.
 
Z

Zouplaz

le 18/12/2006 06:50, Eric Hodel nous a dit:
Can you include a failure?

Yes, the one below - Is there something wrong ? I really don't see the
cause. Just for info, the test_helper.rb is unmodified.

22) Failure:
test_destroy(VehiculesControllerTest)
[./test/functional/vehicules_controller_test.rb:39]:
Expected response to be a <:success>, but was <302>

The overall autotest gives : 81 tests, 309 assertions, 13 failures, 12
errors

************************** vehicules_controller_test.rb

def test_destroy
s = @johnfoo.vehicules.size
post :destroy, :id => @johnfoo.vehicules[0].id
assert_response :success
@johnfoo.reload
assert_equal s-1, @johnfoo.vehicules.size
end

************************** vehicules_controller.rb

def destroy
@client = Vehicule.find(params[:id]).client
Vehicule.destroy(params[:id])
render :partial => 'liste'
end

************************** rake:functionals

(in /usr/local/www/ror_mica)
/usr/bin/ruby -Ilib:test
"/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
"test/functional/clients_controller_test.rb"
"test/functional/telephones_controller_test.rb"
"test/functional/vehicules_controller_test.rb"
"test/functional/alerts_controller_test.rb"
"test/functional/forfaits_controller_test.rb"
"test/functional/mouvements_controller_test.rb"
"test/functional/statistiques_controller_test.rb"
"test/functional/factures_controller_test.rb"
Loaded suite
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader
Started
............................................
..
Finished in 8.999147 seconds.

44 tests, 185 assertions, 0 failures, 0 errors
 
R

Rob Sanheim

le 18/12/2006 06:50, Eric Hodel nous a dit:
Can you include a failure?

Yes, the one below - Is there something wrong ? I really don't see the
cause. Just for info, the test_helper.rb is unmodified.

22) Failure:
test_destroy(VehiculesControllerTest)
[./test/functional/vehicules_controller_test.rb:39]:
Expected response to be a <:success>, but was <302>

The overall autotest gives : 81 tests, 309 assertions, 13 failures, 12
errors

************************** vehicules_controller_test.rb

def test_destroy
s = @johnfoo.vehicules.size
post :destroy, :id => @johnfoo.vehicules[0].id
assert_response :success
@johnfoo.reload
assert_equal s-1, @johnfoo.vehicules.size
end

************************** vehicules_controller.rb

def destroy
@client = Vehicule.find(params[:id]).client
Vehicule.destroy(params[:id])
render :partial => 'liste'
end

************************** rake:functionals

(in /usr/local/www/ror_mica)
/usr/bin/ruby -Ilib:test
"/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
"test/functional/clients_controller_test.rb"
"test/functional/telephones_controller_test.rb"
"test/functional/vehicules_controller_test.rb"
"test/functional/alerts_controller_test.rb"
"test/functional/forfaits_controller_test.rb"
"test/functional/mouvements_controller_test.rb"
"test/functional/statistiques_controller_test.rb"
"test/functional/factures_controller_test.rb"
Loaded suite
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader
Started
...........................................
.
Finished in 8.999147 seconds.

44 tests, 185 assertions, 0 failures, 0 errors

A few things to try before you assume its autotest:

1) run the single failing test method in question by itself
2) run the functional test case in question by itself
3) run the functional test suite by itself

These steps will often turn up issues where fixtures aren't specified
where they should be, or where test order is playing a part (where it
shouldn't be).

- Rob
 
Z

Zouplaz

le 19/12/2006 15:13, Rob Sanheim nous a dit:
A few things to try before you assume its autotest:

1) run the single failing test method in question by itself
2) run the functional test case in question by itself
3) run the functional test suite by itself

These steps will often turn up issues where fixtures aren't specified
where they should be, or where test order is playing a part (where it
shouldn't be).

Good idea, but what is the rake command to only run a test method, a
test case or a test suite ?

Thanks
 
Z

Zouplaz

le 19/12/2006 15:13, Rob Sanheim nous a dit:
A few things to try before you assume its autotest:

1) run the single failing test method in question by itself
2) run the functional test case in question by itself
3) run the functional test suite by itself

These steps will often turn up issues where fixtures aren't specified
where they should be, or where test order is playing a part (where it
shouldn't be).

So, I've tested :
ruby ./vehicules_controller_test.rb
ruby -n ./vehicules_controller_test.rb -n test_destroy
rake test:functionals

They all pass the tests without any problem : 0 error, 0 failure.



autotest still fail...


Any idea again ?
 
J

Jan Svitok

22) Failure:
test_destroy(VehiculesControllerTest)
[./test/functional/vehicules_controller_test.rb:39]:
Expected response to be a <:success>, but was <302>
************************** vehicules_controller_test.rb

def test_destroy
s = @johnfoo.vehicules.size
post :destroy, :id => @johnfoo.vehicules[0].id
assert_response :success
@johnfoo.reload
assert_equal s-1, @johnfoo.vehicules.size
end

************************** vehicules_controller.rb

def destroy
@client = Vehicule.find(params[:id]).client
Vehicule.destroy(params[:id])
render :partial => 'liste'
end

HTTP 302 means Moved temporarily. have a look at your logs to what url
are the tests posting (with or without autotest). Or how the autotest
might interfere with it. Or why :success doesn't include 302.

..not that I know anything about autotest nor rails testing... ;-)
 
D

David Goodlad

le 19/12/2006 15:13, Rob Sanheim nous a dit:


So, I've tested :
ruby ./vehicules_controller_test.rb
ruby -n ./vehicules_controller_test.rb -n test_destroy
rake test:functionals

They all pass the tests without any problem : 0 error, 0 failure.



autotest still fail...


Any idea again ?

It really sounds to me like you've got a missing fixture in those
failing tests.
http://www.railtie.net/articles/2006/10/09/testing-gotchas-in-rails

You need to go through and make 100% sure that you explicitly load all
the appropriate fixtures for all of your test suites.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,221
Messages
2,571,133
Members
47,747
Latest member
swapote

Latest Threads

Top