At 09:31 PM 9/5/2005, Owen Rogers wrote:
> Any reason we shouldn't add this code to Watir?
yes. 2 reasons:
1) it will slow down your tests substantially. 1 second doesn't seem
like a long delay for a single test, but it quickly adds up.
2) this may still produce intermittent failures on slow machines or
servers under heavy load.
i still haven't looked at the code that we used to deal with this
problem. one approach that i remember that we tried was to monitor
the list of running processes to ensure that the closed ie process had
properly terminated -- the test thread would simply wait until the ie
process it had created was gone.
i think that we ended up coming up with something more elegant using
the COM api, but i can't remember what it is.
Good points.
My understanding is that when we do
WIN32OLE.new('InternetExplorer.Application')
for the first time, both a server and a client are created. This is an
Explorer COM Server (not a web server). Later invokations from the same
process create a new client attached to the same server. (This is why they
share the same session and cookies.) The error occurs when we close the
last client of the server, causing it to start shutting down, but then
create a new client which is attached to the server that is shutting down.
The easy way to avoid this problem is to never shut down the last client
until we are done testing.
This could be implemented by attaching an extra client (invisible) to a
class variable of Watir::IE when IE.new was first called. I think this
would be a wholey reliable fix. I'm not sure the cost in performance, but
it could be measured.
Thoughts?
Or to followup on your original post... The Instiki Watir test suite
includes some Windows process handling code that we might be able to snarf.
Bret
_____________________
Bret Pettichord
www.pettichord.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general