Is as way test out swing components without having to rely on Thread.sleep() to make sure that the components have realized completely. This problem with this approach is that it becomes difficult to guess how long it would take for components to realize under different environments of execution like vnc may take more time than running in on the local machine, hence if less time is set in the test case will fail with assertions in the local machine. More time set will increase the time for executing the test.

Recommended Answers

All 3 Replies

You shouldn't need to test your components themselves, as they shouldnt have any business logic in them. MVC, man...

Well it is not entirely possible to separate the View and business logic which dictates how the view should behave upon human interaction, eg how you will alter and render the visual components when mouse drag happens.
I may have figured out that there is a way to block the test case thread from accessing the unrealized components by using SwingUtilities.invokeLater
In the process of testing it out thoroughly so that there are no failures.

Have look at Abbot, claims to be framework for automated testing of Java GUI components and programs. However I never use it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.