This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Testing and the fly likes Journal Article - Hacking JUnit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Testing
Bookmark "Journal Article - Hacking JUnit" Watch "Journal Article - Hacking JUnit" New topic
Author

Journal Article - Hacking JUnit

Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
EJF has written on Hacking JUnit - Adding a simple extension to the JUnit test framework. It has some great information on customizing JUnit.
Post your responses and feedback here.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Nice article with a good example.
I want to point out an alternative solution, though.
The GSBase project, an open source extension to JUnit, offers a RecursiveTestSuite which automatically gathers all the TestCases in a directory tree. It can be configured with a TestFilter object which decides what TestCases to include.
By using those too classes, you could categorize your TestCases in any ways you want, for example using marker interfaces.

This approach seems to be a little bit less complicated to me, but on the other hand makes your test execution depend on the use of the RecursiveTestSuite and also isn't as flexible...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
herbey zepeda
Greenhorn

Joined: Oct 04, 2005
Posts: 5
Hi,

Can anybody help me to understand the value of marker interfaces? what about a nested marker interface within normal interface? what are they useful for?

Thank you

Herbey
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
In short, they were a substitute for class level annotations before Java 5 was released. You can use reflection to find out wether a class implements a specific interface and change it's handling based on that information.

If you want to know more about it, you should probably start a new topic in one of the Java in General forums.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Ilja Preuss:

If you want to know more about it, you should probably start a new topic in one of the Java in General forums.


Or better, search first - this is a topic that gets rather frequently addressed.
 
GeeCON Prague 2014
 
subject: Journal Article - Hacking JUnit