This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
For UI testing it would be helpful if all significant UI components have a unique name. I.e. method setName() should be called for every component which can be tested. Typically these are components that can be accessed by user (JTextField, JButton, ...) but it could be also a JLabel which is used for displaying a changing status information.
Why not reuse Accessibility descriptions? As all Nb dialogs are accessible, they should have AccessibleContext.getAccessibleName(). Maybe that could be reused.
Accessible name is localized. It is better to use name which is unique on all locales.
I recall Tim had some thoughts on this too.
Created attachment 11407 [details] Utility to check if components in .form files have names
I've just attached utility to check whether all component have names. It checks .form files in given directory and its sub directories. It assumes majority of NetBeans' forms has assocciated .form file. Usage is simple, e.g.: java -jar checkForms.jar D:\\cvs\\nb_all\\ant
Two things: 1. You probably don't want to assume form files exist. For example, any GUI forms I've done don't use the form editor. In general, probably more don't have form files than do, at least in core/openide, that I've seen. 2. Will it really handle some of the (unreadable by netbeans) NetBeans 2.0 form files hiding in dark places in the source base? Then again, I can't think of any non-complex way to check for this via the source code. You could write some kind of test that logs offending components at runtime, though. But, yes, this is a great thing to do! We have too many tests that do weird, easily broken things to try to find a component. Using the name is a natural approach, and will make it much harder to break tests for silly reasons!
Yes, you are right. Some of GUI forms will not be checked by this utility either for reason 1 or 2. For those GUI forms it will be responsibility of test developer to check whether components have name. There will exist an utility/test to test it in runtime.
It's been so long time, Jirko is it still an issue, should we do this or could I close this? Shortly what's the status?
It would be a good practice to use setName() but at the time it is not a big issue for us. I think it can be closed.
OK, thanks, closing as wontfix.
Verified.