RE: [wtr-general] Methods written in Tear down not working consistently

2010-11-26 Thread Bey Gmail
Caveat: I've never written a line of code in Watir (nor Ruby) so my response
may be totally off (maybe even )...
...
What are you tearing down?
Seems to me like you are going to the home page.
Wouldn't tear down mean that you would close the session and the browser?
In all oo paradigms I know, a "teardown" means an instance is nullified
(torn down) so it ceases to exist and can be subject to garbage collection.
...
Again, see caveat above
Bey

-Original Message-
From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com]
On Behalf Of Pavithra
Sent: Friday, November 26, 2010 1:53 AM
To: Watir General
Subject: [wtr-general] Methods written in Tear down not working consistently

I have written four test cases in a single script and while running
the same methods written in Tear Down is not working consistently
either for 2nd or 3rd test case and for 4th test case.

I have the following piece of code in Tear down function in my test
script:

def teardown
 Amcp.tophomelink()
end

Under Main.rb:

class Amcp
   @@link_Headhome=$browser.link(:text,"Home")
  class_attr_reader(:link_Headhome)

   def self.tophomelink()
   puts "Tearing down"
   self.link_Headhome.click()
   sleep(10)
  end
end


After the execution of first tc (in the test script), Tear down works
exactly fine. But after the execution of 2nd test case, Teardown is
getting executing -- getting into tophomelink() and printing "tearing
down" in the result; however the headhome link is not getting clicked
(no error thrown also). Its gng to 3rd test case and its failing
(since its failing to locate the element in that page); its tearing
down properly in 3rdtest and 4th test case is getting executed
properly but again failing to click the head home link (under tear
down) for the 4th test case.

I am facing this stupid behavior everyday and I am getting mad because
of this. Kindly help me out to resolve the issue.

Thanks in Advance,
Pavithra

-- 
Before posting, please read http://watir.com/support. In short: search
before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Methods written in Tear down not working consistently

2010-11-26 Thread Željko Filipin
On Fri, Nov 26, 2010 at 7:53 AM, Pavithra  wrote:
> After the execution of first tc (in the test script), Tear down works
> exactly fine.

You do not call teardown method anywhere in the code you have provided. Are
you using test/unit?

Željko

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Methods written in Tear down not working consistently

2010-11-25 Thread Pavithra
I have written four test cases in a single script and while running
the same methods written in Tear Down is not working consistently
either for 2nd or 3rd test case and for 4th test case.

I have the following piece of code in Tear down function in my test
script:

def teardown
 Amcp.tophomelink()
end

Under Main.rb:

class Amcp
   @@link_Headhome=$browser.link(:text,"Home")
  class_attr_reader(:link_Headhome)

   def self.tophomelink()
   puts "Tearing down"
   self.link_Headhome.click()
   sleep(10)
  end
end


After the execution of first tc (in the test script), Tear down works
exactly fine. But after the execution of 2nd test case, Teardown is
getting executing -- getting into tophomelink() and printing "tearing
down" in the result; however the headhome link is not getting clicked
(no error thrown also). Its gng to 3rd test case and its failing
(since its failing to locate the element in that page); its tearing
down properly in 3rdtest and 4th test case is getting executed
properly but again failing to click the head home link (under tear
down) for the 4th test case.

I am facing this stupid behavior everyday and I am getting mad because
of this. Kindly help me out to resolve the issue.

Thanks in Advance,
Pavithra

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com