Hey Prashant,
I'm not exactly sure why your seeing those errors specifically. I tried a
couple of things to see if I could find out what was going on. First I copied
your code into two separate files. I copied
require 'watir'
include Watir
$logger = Logger.new('C:\WebTest\MentorAppTestScripts\logger.log', 5, 1024000)
$logger.level = Logger::ERROR
into a file named Logger.rb. And I copied
require 'watir'
require 'Logger'
include Watir
username = 'watirplayer'
password = 'watirplayer'
puts "## Start MentorApp SQA"
$ie = IE.new
$ie.clear_url_list
$ie.goto("http://mentorapp")
if not $ie.button(:value, 'Login').exists?
$logger.info("Successfull Login")
puts "Successfull Login"
else
$logger.error("Did not log in")
puts "Not able to Login"
end
into a file named Another.rb (just because I couldn't think of another name).
Both of these files were in the same directory. Then I ran them on the command
line. IE launched, then I got these error messages, which are similar to yours:
c:/ruby/lib/ruby/1.8/Logger.rb:172: warning: already initialized constant
VERSION
c:/ruby/lib/ruby/1.8/Logger.rb:174: warning: already initialized constant
ProgName
c:/ruby/lib/ruby/1.8/Logger.rb:181: warning: already initialized constant DEBUG
c:/ruby/lib/ruby/1.8/Logger.rb:182: warning: already initialized constant INFO
c:/ruby/lib/ruby/1.8/Logger.rb:183: warning: already initialized constant WARN
c:/ruby/lib/ruby/1.8/Logger.rb:184: warning: already initialized constant ERROR
c:/ruby/lib/ruby/1.8/Logger.rb:185: warning: already initialized constant FATAL
c:/ruby/lib/ruby/1.8/Logger.rb:186: warning: already initialized constant
UNKNOWN
c:/ruby/lib/ruby/1.8/Logger.rb:424: warning: already initialized constant
SEV_LABEL
c:/ruby/lib/ruby/1.8/Logger.rb:436: warning: already initialized constant Format
c:/ruby/lib/ruby/1.8/Logger.rb:537: warning: already initialized constant SiD
And then I tried the following, and inlined Logger.rb like so:
require 'watir'
[b]require 'watir'
include Watir
$logger = Logger.new('C:\WebTest\MentorAppTestScripts\logger.log', 5, 1024000)
$logger.level = Logger::ERROR
[/b]include Watir
username = 'watirplayer'
password = 'watirplayer'
puts "## Start MentorApp SQA"
$ie = IE.new
$ie.clear_url_list
$ie.goto("http://mentorapp")
if not $ie.button(:value, 'Login').exists?
$logger.info("Successfull Login")
puts "Successfull Login"
else
$logger.error("Did not log in")
puts "Not able to Login"
end
where the bold code is the inlined Logger.rb, and then I ran it (Another.rb)
and got zero errors. So I can only conclude one possibility as to what the
problem might be.
1. Because the file where you initialized your $logger object was named
Logger.rb, maybe there was confusion to Ruby, because the file for Logger in
Ruby is called logger.rb
So try renaming your Logger.rb file to something like MentorAppLogger.rb. I
tried this and I didn't see any errors.
Nathan
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5304&messageID=14753#14753
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general