WRONG WRONG WRONG.
The link actually points to a mail message where i said this exist?/exists?
advice is wrong. And it is.
Bret
P.S. As early posts have pointed out the OP's issue actually relates to the
use of local variables.
At 09:14 PM 8/30/2005, [EMAIL PROTECTED] wrote:
hope this helps.
http://www.mail-archive.com/wtr-general@rubyforge.org/msg00858.html
try using .exist? instead of .exists?
I believe .exists? is deprecated.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, August 30, 2005 9:34 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Problems with Assert method
Good morning WATIR experts,
I apologize for such an elementary post, but I am having difficulty getting
the assert methods to function. I believe my issue is fundamental. Is it
how I am attempting to use assertions? Is it path or environment related?
We have been able to write some really nice WATIR scripts, but I believe in
order for our testing to be more successful we need the unit tests methods
working.
Any suggestions would be greatly appreciated. You will find code and
results below. I am using Eclipse to do this development.
Thanks in advance for your consideration.
Carl
Here is my simplified code:
# feature tests for Text Fields
# revision: $Revision: 1.26 $
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 ==
__FILE__
require '/Apps/watir_bonus/unitTests/setup'
class TC_Fields < Test::Unit::TestCase
include Watir
def setup
puts "Set URL variable"
test_site = 'http://www.yahoo.com'
puts "Start New Browser"
ie = IE.new
puts "Setup: go to the test site: " + test_site
ie.goto(test_site)
#puts "Assertion Test in Position A"
#assert($ie.text_field(:id, "v1").exists?)
end
def Test1
puts "Assertion Test in Position B"
assert($ie.text_field(:id, "v1").exists?)
end
end
This is the result if I place the assertion in position A.
Loaded suite C:/Apps/PowerSeller Test Scripts/carl_textfields_test
Started
Set URL variable
Start New Browser
Setup: go to the test site: http://www.yahoo.com
Assertion Test
E
Finished in 1.101 seconds.
1) Error:
default_test(TC_Fields):
WIN32OLERuntimeError: document
OLE error code:80004005 in <Unknown>
<No Description>
HRESULT error code:0x80020009
Exception occurred.
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:1400:in `method_missing'
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:1400:in `getDocument'
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:721:in
`getContainerContents'
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:743:in `getObject'
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:3471:in `initialize'
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:368:in `new'
C:/Apps/ruby/lib/ruby/site_ruby/1.8/watir.rb:368:in `text_field'
C:/Apps/PowerSeller Test Scripts/carl_textfields_test.rb:25:in `setup'
1 tests, 0 assertions, 0 failures, 1 errors
This is the result if I place the assertion in position B.
Loaded suite C:/Apps/PowerSeller Test Scripts/carl_textfields_test
Started
Set URL variable
Start New Browser
Setup: go to the test site: http://www.yahoo.com
F
Finished in 1.162 seconds.
1) Failure:
default_test(TC_Fields)
[C:/Apps/ruby/lib/ruby/1.8/test/unit/assertions.rb:30:in `assert_block'
C:/Apps/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in
`_wrap_assertion'
C:/Apps/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `assert_block'
C:/Apps/ruby/lib/ruby/1.8/test/unit/assertions.rb:225:in `flunk'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testcase.rb:99:in `default_test'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testcase.rb:70:in `__send__'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testcase.rb:70:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `each'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `each'
C:/Apps/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:44:in
`run_suite'
C:/Apps/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:65:in
`start_mediator'
C:/Apps/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:39:in
`start'
C:/Apps/ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:27:in
`run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/autorunner.rb:194:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit/autorunner.rb:14:in `run'
C:/Apps/ruby/lib/ruby/1.8/test/unit.rb:285
C:/Apps/ruby/lib/ruby/1.8/test/unit.rb:283]:
No tests were specified.
1 tests, 1 assertions, 1 failures, 0 errors
--
"NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential. If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
_____________________
Bret Pettichord
www.pettichord.com
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general