File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Journal Article - Hacking JUnit

 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
herbey zepeda
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic