0
votes

I am setting up automated end to end browser tests(Selenium Webdriver + Ruby) with the intent of making them able to run on my local or on a CI server. How can I require all the files required to run the tests (Page objects)? What is the best way yo set up the folder structure so that I can require easily and maintain organization within my page objects directory?

#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
This is the error I get "NameError: uninitialized constant FAL001::User"Zach

1 Answers

0
votes

you can try:

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