ruby – 如何运行独立的水豚测试?

前端之家收集整理的这篇文章主要介绍了ruby – 如何运行独立的水豚测试?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图针对远程服务器运行测试.即:
require 'rubygems'
require 'capybara'
require 'capybara/dsl'

Capybara.default_driver = :selenium
Capybara.app_host = 'http://www.google.com'


module MyCapybaraTest
  include Capybara

  def test_google
    visit('/')
  end
end

问题是,你怎么跑?

解决方法

保存
require 'rubygems'
require 'capybara'
require 'capybara/dsl'

Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.app_host = 'http://www.google.com'

module MyCapybaraTest
  class Test
    include Capybara::DSL
    def test_google
      visit('/')
    end
  end
end

t = MyCapybaraTest::Test.new
t.test_google

to test.rb和简单地:ruby test.rb

原文链接:https://www.f2er.com/ruby/265408.html

猜你在找的Ruby相关文章