Project

General

Profile

Actions

Defect #12285

closed

Some unit and functional tests miss fixtures and break when run alone

Added by Jean-Baptiste Barth about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I develop many plugins these days, and had the surprise to see the test suite run ok on MacOSX and fail on one of my Linux systems (2 functional tests breaking). Same ruby version, gems, codebase, etc. It turns out it's because tests are not run in the same order on both platforms, and it seems some unit and functional tests depend on other tests and fail if the other test doesn't run before.

To be sure I prepared a test database and ran each test alone :

RAILS_ENV=test rake db:drop db:create db:migrate redmine:plugins db:schema:dump db:fixtures:load
cp db/test.sqlite3 db/test.template.sqlite3
for t in test/**/*_test.rb; do
  cp db/test.template.sqlite3 db/test.sqlite3
  RAILS_ENV=test ruby -Itest $t || echo $t |tee -a tmp/failing_alone.txt
done

Here's the list I ended with, I excluded scm related tests because I'm not sure they actually have a problem (tests run against 2.1.0 stable version, results in trunk may differ but it's a looong thing to run) :

test/functional/groups_controller_test.rb
test/functional/issue_categories_controller_test.rb
test/functional/issue_statuses_controller_test.rb
test/functional/mail_handler_controller_test.rb
test/functional/queries_controller_test.rb
test/functional/search_controller_test.rb
test/functional/sessions_test.rb
test/functional/welcome_controller_test.rb
test/integration/api_test/issues_test.rb
test/integration/api_test/users_test.rb
test/integration/issues_test.rb
test/unit/comment_test.rb
test/unit/issue_category_test.rb
test/unit/issue_relation_test.rb
test/unit/issue_test.rb
test/unit/journal_observer_test.rb
test/unit/journal_test.rb
test/unit/lib/redmine/menu_manager/menu_helper_test.rb
test/unit/message_test.rb
test/unit/project_test.rb
test/unit/role_test.rb
test/unit/time_entry_activity_test.rb
test/unit/version_test.rb
test/unit/watcher_test.rb

For most of them I think the fix may be easy, it's just a missing fixture, a coupling with a previous record or a missing setting. I'll try to see what's the problem in each case and commit fixes in trunk as I find them.

Actions

Also available in: Atom PDF