Ruby on Rails Saturday, April 30, 2011

Hi, 


I'm starting to use Test::Unit to create unit tests for my Rails Applications/Plugins. I don't have much experience in Ruby Unit Testing. The problem is that the output report is very simple and it is very difficult to discover where is the error. Test::Unit does not show the line number of the error and the Stack Trace printed using the --trace option does not help either.

Here is the output of my test:

/home/gustavo/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/gustavo/.rvm/rubies/ruby-1.9.2-p180/bin/rake test:plugins --trace
Testing started at 23:18 ...
(in /home/gustavo/Projetos/seo_apps)
** Invoke test:plugins (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute test:plugins

NoMethodError: undefined method `score=' for #<Report:0xa1f269c>
1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
Test suite finished: 0.132010162 seconds
rake aborted!
Command failed with status (1): [/home/gustavo/.rvm/rubies/ruby-1.9.2-p180/...]
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:995:in `block in sh'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1029:in `ruby'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1094:in `ruby'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/test_unit/testing.rake:26:in `block (2 levels) in define'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/test_unit/testing.rake:11:in `block in define'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/home/gustavo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/gustavo/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/gustavo/.rvm/rubies/ruby-1.9.2-p180/bin/rake:35:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'

Process finished with exit code 1


Please, anyone have an idea of how to improve this error output??

Thanks in advance,
Gustavo

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment