2
當我在一個測試類中有很多測試時,我使用Module對測試進行分組。在Test :: Unit中使用模塊對測試進行分組
因爲我很新的軌道,我的問題是:
是不是正確的方式來組測試或我在做很愚蠢的事情不知道其他的副作用?
下面是代碼:
require 'test_helper'
module AttributeValidationTest
extend ActiveSupport::Testing::Declarative
test "should not ...." do
# .....
end
# other tests here....
end
module AnotherGroupTest
extend ActiveSupport::Testing::Declarative
# tests.....
end
# may be another modules..
class MyModelTest < ActiveSupport::TestCase
include AttributeValidationTest
include AnotherGroupTest
end
感謝。