This topic used to occupy most of this HOWTO guide. For good or for ill, JUnit version 4 hasn't obligated to a way to declaratively or flexibly organize and nest test methods. There is very little here for you to learn. The still evolving JUnit feature of Catalogs should some day take care of the use case previously served by Test Suites.
You just tell your test runner what Test Classes to execute. For each specified Test Class, an instance of the Test Class is constructed; @BeforeClass methods are executed (if any); then the cycle of @Before-methods + @Test-method + @After-methods gets executed for each test method in the class; and finally all @AfterClass methods execute (if any). You control the test methods which get executed in the class simply by adding or removing @Test attributes to/from methods.
You can also temporarily disable a test method by prevising @Test with "@Ignore". This is a very useful practice, because it produces a message upon test execution so the test method won't be forgotten when it is in disabled state.
$Revision: 2422 $
Copyright © 2008, 2009
Axis Data Management Corp.