About GroboUtils For Developers | GroboTestingJUnit version 1.2.1 Design of IFTCAuthor:Matt Albrecht The Interface / Hierarchial Test Classes (IFTC) creates inheritance extensions of the commonly used JUnit framework: TestSuite, Test, and TestCase. The InterfaceTestCase class is the IFTC extension to TestCase. It has provisions for allows concrete test classes to create factories that create instances for the InterfaceTestClass to test. These factories must be of type ImplFactory, and its creation method must return a non-null instance of the interface or class which the InterfaceTestClass is testing. The InterfaceTestSuite class extends the JUnit TestSuite, allowing for the registration of InterfaceTests and Tests, as well as ImplFactory instances for the association with registered InterfaceTests. These InterfaceTestSuite instances can be chained together, contain multiple InterfaceTests, and be contained within TestSuites to create complex test setups (see Using IFTC). ImplFactory implementations know how to generate an instance of a concrete class which an InterfaceTestCase subclass should test. Implementations of the subinterface ICxFactory can tear down instances which were created during InterfaceTestCase's tear down method. TraceabilityOne goal of IFTC (see requirements and goals) is to provide an easy way for users to trace errors in the hierarchial tests. Without such traceability, the user has no way of telling which context / ImplFactory caused an error in a test; the error report will simply tell the user in which inherited class and method the error occured. As of version 1.0.0, IFTC supports reporting the name of the factory in the InterfaceTestCase's getName() method via the factory's own toString() method. The CxFactory class adds an ease-of-use functionality that helps generate a clear toString() descriptor for each new factory instance. Optionally, InterfaceTestCase's getName() method can also add in the its instance's class name (without the package) to further specify in which test class the test was executed. As current as Ant 1.5.1, Ant JUnit reporter task (specifically, XMLJUnitResultFormatter) does not use the toString() method to describe the tests that ran, but instead uses the TestSuite getName(), and TestCase getName() (or name() for backwards compatibility). Therefore, there exists a need to change getName(), as only changing toString() will not solve this traceability issue. If someone finds that this severely breaks something else that expects getName() to only return the method name, then contact the project. Effects of JUnit 3.8.1JUnit 3.8.1 includes a new feature that 3.7 and earlier versions did not include: the test constructor no longer requires taking a String argument, and instead the test name can be set through the setName() method. As a result, the GJE TestClassParser class needs to imitate the new TestSuite functionality. InterfaceTestCase still takes only the factory-expected instance in its constructor. See the JavaDoc for InterfaceTestCase as to why this route was taken. |
This space graciously provided by the SourceForge project | Copyright ©
2002-2004 GroboUtils Project. All rights reserved. |