我的rakefile selenium任务没有运行任何测试,也没有出错。 我的档案:
Rakefile
desc 'Selenium test'
task :selenium => [:init] do
RSpec::Core::RakeTask.new() do |t|
t.pattern = 'test/selenium/*.rb'
t.verbose = true
end
print 'wtf'
end
测试/硒/ test1.rb:
require "selenium-webdriver"
require "rspec"
include RSpec::Expectations
describe "Test" do
before(:each) do
@driver = Selenium::WebDriver.for "ie"
@base_url = "my site"
@driver.manage.timeouts.implicit_wait = 10
@verification_errors = []
@driver.get(@base_url)
end
after(:each) do
@driver.quit
@verification_errors.should == []
end
it "test_" do
#verify { element_present?(:link, "Edit campaign").should be_true }
verify { element_present?(:link, "Campaign list").should be_true }
(@driver.find_element(:link, "Campaign list").text).should == "Campaign list"
end
def element_present?(how, what)
结果:
wtf
测试未运行,未显示错误
答案 0 :(得分:1)
重命名:
test/selenium/test1.rb
为:
test/selenium/test1_spec.rb