[Webtest] Re: verifyElementText ElementNotFoundException inside "not"

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Thu, 05 Apr 2007 13:25:22 +0200

Hi Michael,

verifyElementTextTest gets the element by id if an html id is specified
and the HtmlUnit method throws an ElementNotFoundException if no element
is found with this id. As this exception is not catched to be wrapped in
a StepFailedException it gets wrapped in a StepExecutionException which
isn't what the <not> is waiting for.

More generally we've had for perhaps 1 year on this mailing list a
discussion concerning the differences between failures
(StepFailedException) and errors (StepExecutionException) but couldn't
agree on the real distinction criteria. I think that we should look at
it again and probably use only one of them.


Michael Habbert wrote:
> Hi Marc,
> I'm curious, how do you know it is a bug?
> I just added a test-method to VerifyElementTextTest and I succeeded.
> -----------
> (extended the HTML_DOCUMENT first)
>     public void testaHrefWithId() throws Exception {
>         // <verifyElementText htmlId="someId" text="The regex."
> regex="true" />
>         fStep.setHtmlId("someOtherId");
>         fStep.setText("(?i:Approve)");
>         fStep.setRegex("true");
>         executeStep(fStep);
>     }
> ----------
> So It worked for my additional test - I am wrong?
> Michael
> Marc Guillemot wrote:
>> This is clearly a bug. Can you open an issue for it?
>> You say that you get the same exception using something like
>> <verifyXPath xpath="//*[@id='topApprove']" .../>? Correct? Seems strange
>> to me, I have to check.
>> Marc.
> [...]