You need to be consistent. Either use RegUserNameLabel in both files or $RegUserNameLabel in both files. You use the first in Constants.rb and the second in Register.rb.

On 3/7/06, saud aziz <[EMAIL PROTECTED]> wrote:
In the recent emails it was described how ppl are splititng up their code in different files and since i am at the very start of writing down something for proof of concept, i thought it would be wise to begin with such structure and keep adding as i go along...

My question is perhaps very simple one and that is, how can i call a variable say RegUserName as mentioned in below code from my test driver? RegUserName exists in Constants.rb file. Here is what i have for both as example:

Constants.rb

Module Constants

RegUserNameLabel = 'first'
RegUserName = 'second'
RegPassLabel = 'third'
RegPassword = 'fourth'

end


Register.rb
#trying to run this as driver for now
require 'watir'
include Watir
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'test/unit/assertions'
include Test::Unit::Assertions


class TC_Tickets < Test::Unit::TestCase

require 'Constants'
include Constants
   
    def test_Registration
     
      ie = IE.new
     
        ie.goto(' http://firstlink')
        ie.link(:url, ' http://secondlink/register').click
     
     
      #Check for blank submissions and assert that errors were raised
      #ie.image(:id, 'btn_register').click
      ie.button(:name, "#{$RegFormButtonName}").click
     

        ie.text_field(:id, "#{$RegUserNameLabel}").set("#{$RegUserName}")                           <-----dies here cause it returns nil. Obviously it's not getting values off Constants.rb
        ie.text_field(:id, "#{$RegPassLabel}").set("#{$RegPassword}")

end
end


Any help is appreciated.

Regards
Ruby n00b

--
Saud Aziz

"Whenever you find yourself on the side of the majority, it is time to pause and reflect." - Mark Twain




_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to