|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
TestContext | The interface that is to provide support to the unit tests. |
UnitTest |
Class Summary | |
BatchRunner | Recurse from the current user directory and find all .class files that are UnitTest and add to our list of tests. |
TestImpl | Hide the details of the JUnit test framework. |
TestRunner | Hide the details of the JUnit test framework. |
UnitTestBaseImpl | Provide all of the default implementation code. |
A set of core classes to help with unit testing efforts. An abstraction between our code and JUnit. By using this abstraction, users of our libraries are not required to obtain JUnit for their application development needs. Only if you actually run the unit tests does a dependency upon JUnit exist.
The key to using this package is to create test classes that extend com.objectwave.test.UnitTestBaseImpl. A typical unit test declaration looks like the following:public class Test extends UnitTestBaseImpl { public static void main( String [] args ) { com.objectwave.test.TestRunner.run( new Test(), args ); } public void testSomeBusinessLogic() throws Exception { boolean value = new MyClass().doSomeWork(); testContext.assert( "The value is incorrect! ", value); } }In the example I have a single test method that will be executed when the TestRunner run's the tests. Any public method that starts with the word 'test' will be invoked by the test runner. To run all my unit tests, I would simply type
java TestThere are some additional features found on UnitTestBaseImpl that should be checked out. The goal is to help you write tests with the LEAST amount of pain as possible. So, just do it. Stuff relating to the current running tests, such as the ability to do assertions, is abstracted into com.objectwave.test.TestContext. An instance variable within UnitTestBaseImpl contains a reference to an instance of the TestContext and is intended to be used within your tests (as the example shows).
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |