Can one unit test Java Interfaces with JUnit?
1 posts in topic
Flat View  Flat View

Posted By:   Adam_Gordon
Posted On:   Wednesday, March 20, 2002 10:47 AM

Does anyone who's had some experience know whether or not JUnit can perform unit tests on interfaces?

Specifically, we've defined a set of Interfaces to which vendors when creating their product must comply. We'd like to be able to test whether or not they have implemented the methods we've defined in our interfaces correctly. These tests will include verifying listeners, events, and graphics do what they're supposed to do. Obviously, the graphics portion must be verified visually, but what about the non-visual portions of methods?

Can JUnit test this?



Re: Can one unit test Java Interfaces with JUnit?

Posted By:   Dave_Astels  
Posted On:   Monday, April 1, 2002 04:37 PM

Sure, write your tests to the interface and have some way (an abstract factory maybe) to specify at runtime what set of concrete classes in use.

As to visually verifying the graphics part... maybe, maybe not. William Wake wrote a paper on using jUnit to test GUIs, which appeared in "Extreme Programming Installed" and is available at http://www.xp123.com/xplor/xp0001/index.shtml. I noticed that there is also now jfcUnit for testing Swing interfaces. I haven't played with it yet, though. There was a sesison at JavaOne last week about it: TS-1982.


About | Sitemap | Contact