I can see that we were coming from different perspectives. But please keep in mind that not only the functionality but also the "scope" (pardon the word) of Watir may be expanding . . . I know of several people at least who use it for things other than testing. Our application DOES use Watir, and I was just trying to point out a potential pitfall for anyone else in the same boat. Someone else brought up the subject and I felt a warning might be appropriate.

Globals certainly have their place, and it was not my intention to contradict anything you said . . . just to share some experience. They can cause problems. What susprises me, though, is the comment that "most" people here do not use Rails? That seems strange to me . . . I would have thought it the ideal environment for Watir.

Lonny Eachus
==========


Subject:
Re: [Wtr-general] BUG: New IE windows share session state with existingopen windows
From:
"Bret Pettichord" <[EMAIL PROTECTED]>
Date:
Wed, 7 Jun 2006 12:53:56 -0500

. . .

I thought you were giving advice to Watir users, and that was why i complained. I certainly see know how global variables could get you into the kind of trouble you were talking about using Mongrel and Rails. Your Mongrel server is running continuously and it stores your global variables. Of course. I can also see how this lead you to trouble, but i suggest that one of the Rails or Ruby forums is a better place for you to discuss the problem. I fear it will only lead to confusion mostly amongst people who can't really benefit from your experience (because most people here aren't using Rails). Your problem was really a development problem not a testing problem.

When people are using Watir for testing, they are running tests in a separate process and successive runs are in different processes, so globals won't raise these kinds of problems. There are other reasons to avoid globals, but these mostly pertaining to making code more maintainable. I will continue to suggest global variables to new users who are starting to use Watir.

Bret








Subject:
Re: [Wtr-general] BUG: New IE windows share session state with existingopen windows
From:
"Michael Bolton" <[EMAIL PROTECTED]>
Date:
Wed, 7 Jun 2006 13:56:56 -0400
To:
<wtr-general@rubyforge.org>
To:
<wtr-general@rubyforge.org>

>I see three ways this could happen, there may be more: (1) The variable "global_foo" is truly "global" on that server from the moment it is instantiated, and remains in memory even when there is no "running code". This is contrary to the way I understood globals to function . . . in which case there was a misunderstanding regarding scope, which in turn is due to lack of adequate documentation. That is to say, it was my understanding that controllers constitute "top level" code, and therefore when a controller exits, all information that is "global" to that controller should be lost. If, however, a "global" functions across controllers, effecting the whole "app", then this makes sense . . . but should be better documented. (2) The variable "global_foo" is supposed to be global only up to the controller context, but something went wrong and it is getting improperly preserved. (3) The POST variables are being improperly preserved (cached) between sessions.

>In order of decreasing liklihood, I would rank these (1), (3), (2). When I stated that this could be due to some kind of server caching, I was referring to situation (3) . . . POST variables being improperly cached. That could be tested but I do not think it is very likely.

It's always remarkable to me that the people are quickest to suspect that there's a bug in the language--not a bug in their test code, and not a bug in the application under test.
 
Do you think it's more likely that Ruby preserves the value of variables across runs, even when memory is deallocated?  Remember that the operating system would have to collaborate by preserving the contents of whatever address the global points to.
 
---Michael B.



Subject:
Re: [Wtr-general] [question] Setting timeout for a ie.wait method?
From:
"Bret Pettichord" <[EMAIL PROTECTED]>
Date:
Wed, 7 Jun 2006 13:01:39 -0500
To:
wtr-general@rubyforge.org
To:
wtr-general@rubyforge.org

On 6/7/06, Rodrigo Julian Martin <[EMAIL PROTECTED]> wrote:

Hello Bret, ie.down_load_time is a Watir 1.5 feature, right?

No. It's been in Watir for a long time. It is in 1.4.1.

Well, I need a way of check that each link that was clicked have loaded "completely" a page, else I need to report which link fails.

So, I first think of setting a timeout to the wait, something like "if after 10 seconds the wait state is still there, let's suppose the page

hasn't loaded".

 

1)       Bret, could I manage this with an assert sentence in 1.4.1?

No. You would need to write multi-threaded code to do this.

2)        Can I catch html messages like "200 OK" after clicking a link?

3)       Can I manage html load errors like 404 File Not Found?

You might try experimenting with ie.add_checker -- look at Navigation Checker in watir.rb. (Also in 1.4.1)


_______________________________________________ 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

Reply via email to