Bug 259906 - Improved error messages for SWTBot widgets
Summary: Improved error messages for SWTBot widgets
Status: RESOLVED FIXED
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: 2.0.0-dev   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0.0   Edit
Assignee: Ketan Padegaonkar CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2009-01-04 04:32 EST by Ketan Padegaonkar CLA
Modified: 2009-01-28 05:06 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ketan Padegaonkar CLA 2009-01-04 04:32:16 EST
Description copied from http://swtbot.org/bugzilla/show_bug.cgi?id=144:

If a widget can?t be found for some reason a exception is raised, for example:

org.eclipse.core.runtime.AssertionFailedException: assertion failed: Widget SWTBotText Text {} is not enabled.

But I haven?t searched for the widget by the text attribute but by its label:
... bot.textWithLabel(?Picture location?);

It would be nice if SWTBot could take this in the error message into consideration, that a widget was searched for by label. Then it is easier to identify it just by the error message.

But that is of course just a ?nice to have? feature.
Comment 1 Ketan Padegaonkar CLA 2009-01-04 05:07:38 EST
The SWTBot widget wrappers now have an additional constructor, that takes in a SelfDescribing that can describe the widget, it is convinient to pass in the org.hamcrest.Matcher that was used to find the widget as a SelfDescribing. This generates messages like:

- SWTBotButton - (AbstractSWTBot.java:137) - Enquing event Deactivate [27]: ShellEvent{Button {*Disposed*} time=-1594706202 data=null doit=true} on (of type 'Button' and with mnemonic 'OK' and with style 'SWT.PUSH')

- Expected widget (of type 'Button' and with mnemonic 'One' and with style 'SWT.PUSH') to be enabled.
Comment 2 Ketan Padegaonkar CLA 2009-01-04 05:11:42 EST
If there's anything else you think may improve error message, please add a comment to this bug.
Comment 3 Ketan Padegaonkar CLA 2009-01-11 01:29:57 EST
Hans, Ketan,

Do you have anything else in mind to improve error messages, I'd like to close this bug ?
Comment 4 Ketan Patel CLA 2009-01-11 10:59:41 EST
I think this is good...can always reopen or create new bug when we run into other cases. 

(In reply to comment #3)
> Hans, Ketan,
> 
> Do you have anything else in mind to improve error messages, I'd like to close
> this bug ?
> 

Comment 5 Hans Schwaebli CLA 2009-01-28 05:06:02 EST
I have nothing else in mind currently.