A couple of thought provokers for the aspiring great manager:
Speaking of upcoming conferences this Fall, I just remembered Google's conference on testing in London, September 7-8th. It sounds like a mighty interesting conference for professional test engineers.
It seems that not that many developers migrating to JUnit 4 are aware of the replacement for the old way of building suites--using the static suite() method and the junit.framework.TestSuite class--I decided to blog a simple example for Google's indexing hamsters to grab hold of.
Here we go:
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
TestCalculatorAddition.class,
TestCalculatorSubtraction.class,
TestCalculatorMultiplication.class,
TestCalculatorDivision.class
})
public class CalculatorSuite {
// the class remains completely empty,
// being used only as a holder for the above annotations
}
The above class is a simple placeholder for the suite annotations, not containing any other functionality as such. The key is in the @RunWith annotation, which tells the JUnit 4 test runner to use the org.junit.runners.Suite class for running this particular class. The @Suite annotation, on the other hand, tells the Suite runner which test classes to include in this suite and in which order.
I hope this helps folks out there since it doesn't seem to be documented too well in junit.org.
update: there's an upcoming book - a 2nd edition of JUnit in Action that's going to cover JUnit 4. Its release is scheduled for June 2009 so there's still some time before the apparent documentation gap should be gone. Having said that, the book is on Manning's early access program (MEAP) so we should start seeing more and more chapters as we near the release date.








