I agree. I would start fresh for every test case. Maybe that makes it
run too slowly?

Regarding Željko's comment, I found that rspec has 2 different kinds
of "teardown"
after(:all) - runs after each "it" test case
after(:each) - runs after the last "it" test case
http://rspec.info/documentation/
That's pretty cool.

Good luck,

Dave

On Nov 26, 6:48 am, "Bey Gmail" <amelame...@gmail.com> wrote:
> Caveat: I've never written a line of code in Watir (nor Ruby) so my response
> may be totally off (maybe even ooooffff)...
> ...
> 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 readhttp://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-gene...@googlegroups.comhttp://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

Reply via email to