我一直试图从 rake 文件中调用单个单元测试方法来自动化我的测试,但我一直收到错误消息。每次我运行 'rake manage' 时,我的 'manage' 任务都会出现错误:错误的参数数量 0 代表 1。这是我的 rake 文件:
require "test_file"
task :default => [:commands]
task :manage do
myTest = Unit_Test.new
myTest.test
end
我的实际类使用了 Test::Unit::TestCase 类。这是在一个名为“test_file.rb”的单独文件中。
class Unit_Test < Test::Unit::TestCase
include Rack::Test::Methods
def test
puts "this is just a test"
end
end
有错误指向:
myTest = Unit_Test.new
如何从此类中调用各个方法?我基本上想在不同的任务中调用这个类的某些方法,但我无法让它工作。我如何让这个工作?