我尝试在Rspec中创建一个简单的测试套件。
require "selenium-webdriver"
require "rspec"
describe "User" do
before (:all) do
@ch = Selenium::WebDriver.for :chrome
end
it should "navigate to open2test" do
@ch.get"http://www.open2test.org/"
end
it should "enter user name and email" do
@ch.find_element(:id, "name").send_keys "jack"
@ch.find_element(:id, "emailID").send_keys "jack@gmail.com"
end
end
执行rspec file_name.rb
时,我得到:
"rspec/expectations/handler.rb:50:in `block in handle_matcher': undefined method `matches?' for "navigate to open2test":String (NoMethodError)"
请更新我遗失的内容。
答案 0 :(得分:2)
您正在调用it
和should
方法。
it should "navigate to open2test" do
在使用RSpec
时,您应该只在此处拨打it
it "should navigate to open2test" do
# assert something
end
注意,其应具有Test::Unit
should "do something" do
# assert something
end