0

我一直试图从 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

如何从此类中调用各个方法?我基本上想在不同的任务中调用这个类的某些方法,但我无法让它工作。我如何让这个工作?

4

1 回答 1

0

你有没有考虑过

ruby test_file.rb --name test_method_to_be_run

还是您需要运行多种测试方法?

另外,您使用的是哪个版本的 Ruby?1.8 还是 1.9?

于 2011-06-17T00:23:41.737 回答