आप रूबी 1.9 का उपयोग करें और spork का उपयोग करें और टेस्ट :: इकाई (वास्तव में MiniTest) के साथ Autotest को यह कोशिश करना चाहते हैं:
Gemfile:
group :test do
# Newer version of test::unit:
gem 'minitest'
# spork preloads a rails instance which is forked every time the tests are
# run, removing test startup time.
gem 'spork'
# Run 'spork minitest' to start drb server (test server). Use 'testdrb' to
# run individual tests via spork.
gem 'spork-minitest'
# Run 'bundle exec autotest' to rerun relevant tests whenever a file/test is
# changed. '.autotest' makes sure the tests are run via test server (spork).
gem 'autotest-standalone'
# -pure gives us autotest without ZenTest gem.
gem 'autotest-rails-pure'
end
.autotest:
class Autotest
# run tests over drb server (spork)
def make_test_cmd files_to_test
if files_to_test.empty?
"" # no tests to run
else
"testdrb #{files_to_test.keys.join(' ')}"
end
end
end
(नोट: निर्देश bin/testdrb
कहते हैं, लेकिन मैं testdrb
में बदल यह मेरे लिए काम करने के लिए।)
एक टर्मिनल में:
spork minitest --bootstrap
संपादित test/test_helper.rb
और निर्देशों का पालन करें।
spork minitest
अंत में एक और टर्मिनल में Autotest शुरू:
bundle exec autotest
और (उम्मीद) MiniTest साथ वास्तव में तेजी से autotesting का आनंद
के बाद ऊपर सेटअप एक बार किया जाता है, आप परीक्षण सर्वर शुरू कर सकते हैं ।
स्रोत
2012-06-25 13:25:39
बढ़िया! बेहतरीन लेख के लिए धन्यवाद! यह मेरे लिए पूरी तरह से काम करता है। – Shuo