0

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

#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
4

1 回答 1

0

你可以试试:

Dir['test-case-folder/test*.rb'].each { |f| require f }
于 2012-11-27T20:21:16.833 回答