Unit testing is typically done by software developers to ensure that the code they have written meets software requirements and behaves as the developer intended.
The following naming conventions have been established for unit testing.
The naming conventions for test fixtures are summarized below.
abstract and are named AbstractFooTestCase, where Foo is the name of the abstract type that specifies the requirement. BarAsFooTest, where Foo is the abstract type and Bar is the concrete type. BarTest, where Bar is the type. The following table provides examples of the above conventions.
Type to Test
Test Fixture
Test Fixture Purpose
interface IFoo
abstract class AbstractFooTestCase
Test concrete classes that implement IFoo to ensure they satisfy the interface contract.
abstract class AbstractFoo
abstract class AbstractAbstractFooTestCase (1)
Test concrete classes that extend AbstractFoo to ensure they satisfy the abstract class contract.
abstract class AbstractFoo
class AbstractFooTest
Test the implementation of AbstractFoo.
class Bar implements IFoo
class BarAsFooTest extends AbstractFooTestCase
Test Bar to ensure it satisfies the contract of IFoo.
class Bar extends AbstractFoo
class BarAsAbstractFooTest extends AbstractAbstractFooTestCase
Test Bar to ensure it satisfies the contract of AbstractFoo.
class Bar
class BarTest
Test the implementation of Bar not related to any interface it may implement or abstract class it may extend.
(1) Yes, this is ugly, but unfortunately necessary to avoid collisions in test fixture names between interfaces and abstract classes.