我有,我想在很多测试情况下使用的一类:Ruby Watir无法在运行类之外找到assert方法?
require 'rubygems'
require 'test/unit'
require 'watir'
class Tests < Test::Unit::TestCase
def self.Run(browser)
# make sure Summary of Changes exists
assert(browser.table(:class, "summary_table_class").exists?)
# make sure Snapshot of Change Areas exists
assert(browser.image(:xpath, "//div[@id='report_chart_div']/img").exists? )
# make sure Integrated Changes table exists
assert(browser.table(:id, 'change_table_html').exists?)
end
end
然而,在我的测试情况下,一个运行时:
require 'rubygems'
require 'test/unit'
require 'watir'
require 'configuration'
require 'Tests'
class TwoSCMCrossBranch < Test::Unit::TestCase
def test_two_scm_cross_branch
test_site = Constants.whatsInUrl
puts " Step 1: go to the test site: " + test_site
ie = Watir::IE.start(test_site)
Tests.Run(ie)
end
end
我得到的错误:
NoMethodError: undefined method `assert' for Tests:Class
C:/p4/dev/webToolKit/test/webapps/WhatsIn/ruby-tests/Tests.rb:8:in `Run'
缺少什么?谢谢!
我从来没有在测试中跑过测试。我可以看到你正在尝试做什么。也许你只是把断言放在父测试中,没有孩子? – 2011-01-24 22:59:33