At 04:28 AM 11/29/2005, Mike Williams wrote:
Bret Pettichord wrote:
We [...] have a problem with tests hanging on clickAndWait or
typeAndWait.
The problem is that our pages have javascript validation. These
actions only result in a post if the javascript validates. We have
tests that hang because the data fails the validation. The
clickAndWait is waiting for a page load that will never happen.
Can you predict that the validation is going to fail, based on the state
of the app at that point in the test? If so, try using "click" rather
than "clickAndWait" at those points.
When the test passes, clickAndWait is the right thing to do. The problem is
that it is failing unexpectedly. Except of course we expect our tests to
fail unexpectedly -- otherwise there would be no point in ever running them.
The problem is that when this happens, it hangs the suite.
I'm in the process of trying to convince a QA team to accept using some
Selenium tests. Problems like this are preventing acceptance.
I think we all agree that test failures, for whatever reason, should not
hang the entire suite.
P.S. This is not a problem with Watir. It only has one click command
and it automatically waits when it should.
How do you get Watir to wait automatically?
Originally, we tried to get Watir to wait based on events (like Selenium),
but this didn't work out -- i don't know the details -- and so we moved to
using the current method. We poll the browser, the document (and frames if
there are any) to see if it is busy or complete. We actually have to check
a couple times before we decide it really is done. Sometimes it will be
momentarily non-busy or complete while a page is still loading.
It felt like a hack at the time, and the code is pretty hairy, but it
actually has been very reliable.
Making the wait logic automatic was a key new feature that push Watir ahead
of Samie, which had been the leading IE Driver.
It would be fantastic if we could get Selenium to wait when appropriate,
and do away with the "AndWait" hint. I actually had an implementation of
this (waiting automatically) working quite some time back, but it was
based on "onbeforeload" and "onbeforeunload" events which, while they work
in IE and Firefox, are non-standard. We figured there wasn't much point
implementing that solution when restricted Selenium's portability.
I don't know. Either this, or we just put a timeout on the waits. Either
way, we can't allow failed tests to hang a suite.
Bret
_____________________
Bret Pettichord
www.pettichord.com
_______________________________________________
Selenium-devel mailing list
Selenium-devel@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel