Artima Weblogs |
Vladimir Ritz Bossicard's Weblog |
Discuss |
Email |
Print |
Bloggers |
Previous |
Next
|
Sponsored Link •
|
Summary
Passing or failing: these are the usual states of JUnit tests. But discover a third state that many use but only few acknowledge, and how you can elegantly manage these tests with JUnit-addons Runner.
Advertisement
|
Tests can either pass or fail. Thus they are binary.
Looking at several Open Source projects (and my own practice) I've noticed numerous tests whose names were altered or simply commented out only to exclude this particular test from the general execution.
But why should you ever exclude a test? Plenty of very good reasons:
One solution can be to create another test suite for these tests but my experience is that doing so is the exception, not the rule. Fortunately the JUnit-addons Runner offers a flexible and elegant solution to this problem.
One of the features of this runner is its ability to ignore a test by simply appending _ignored to its method's name (public void testDummy becomes public void testDummy_ignored). When executing the suite, the runner outputs:
**** Elapsed time: 0.005 sec (4 tests + 1 ignored) IGNORED 1) testDummy_ignored (junitx.example.IgnoredTestCase)All your tests now pass and you (and other developers) are always reminded that there is still work to be done.
The JUnit-addons Runner is available at sourceforge.net/projects/junit-addons
Have an opinion? Readers have already posted 15 comments about this weblog entry. Why not add yours?
If you'd like to be notified whenever Vladimir Ritz Bossicard adds a new entry to his weblog, subscribe to his RSS feed.
Vladimir Ritz Bossicard is a software engineer located in the Bay Area. He has a Master's degree in Computer Science from the EPFL and is interested in Open Source Software and pragmatic testing. Besides software engineering his main interest is his daughter Thea. |
Sponsored Links
|