红宝石的最佳实践要求

时间:2012-11-27 20:19:00

标签: ruby continuous-integration require

我正在设置自动端到端浏览器测试(Selenium Webdriver + Ruby),目的是让它们能够在我的本地或CI服务器上运行。如何要求运行测试所需的所有文件(Page对象)?设置文件夹结构的最佳方法是什么,以便我可以轻松地在页面对象目录中进行组织和维护?

#I am trying to eliminate all the absolute paths below
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\Users\\userdata.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\Users\\user.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\General\\nav.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\General\\login.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\General\\dash.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\members\\manageMembers.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\members\\accountsReceivable.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\members\\createMember.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\members\\newPayment.rb"
#require "C:\\Users\\workspace\\FalconQA\\PageObjects\\members\\createInvoice.rb"

#This doesn't seem to work 
Dir['\\FalconQA\\*.rb'].each { |f| require f }

require "selenium-webdriver"
require 'test-unit'
gem 'test-unit'
class FAL001 < Test::Unit::TestCase 
  def testFAL001
    $user = User.new("tester2")
    login = Login.new 
    login.username($user.name)
    login.password($user.password)
    login.submit.members.noImmediateDropDown.accountsRecievable("NAme").newPayment.createInvoice
    $user.stop
  end
  def testFAL002 
    puts " THis is a test "
  end
end

1 个答案:

答案 0 :(得分:0)

你可以尝试:

Dir['test-case-folder/test*.rb'].each { |f| require f }