| java.lang.Object org.apache.jorphan.test.AllTests
AllTests | final public class AllTests (Code) | | Provides a quick and easy way to run all junit unit tests in your java
project. It will find all unit test classes and run all their test methods.
There is no need to configure it in any way to find these classes except to
give it a path to search.
Here is an example Ant target (See Ant at Apache) that runs all your unit
tests:
<target name="test" depends="compile">
<java classname="org.apache.jorphan.test.AllTests" fork="yes">
<classpath>
<path refid="YOUR_CLASSPATH"/>
<pathelement location="ROOT_DIR_OF_YOUR_COMPILED_CLASSES"/>
</classpath>
<arg value="SEARCH_PATH/"/>
<arg value="PROPERTY_FILE"/>
<arg value="NAME_OF_UNITTESTMANAGER_CLASS"/>
</java>
</target>
- YOUR_CLASSPATH
- Refers to the classpath that includes all jars and libraries need to run
your unit tests
- ROOT_DIR_OF_YOUR_COMPILED_CLASSES
- The classpath should include the directory where all your project's
classes are compiled to, if it doesn't already.
- SEARCH_PATH
- The first argument tells AllTests where to look for unit test classes to
execute. In most cases, it is identical to ROOT_DIR_OF_YOUR_COMPILED_CLASSES.
You can specify multiple directories or jars to search by providing a
comma-delimited list.
- PROPERTY_FILE
- A simple property file that sets logging parameters. It is optional and
is only relevant if you use the same logging packages that JOrphan uses.
- NAME_OF_UNITTESTMANAGER_CLASS
- If your system requires some configuration to run correctly, you can
implement the
UnitTestManager interface and be given an opportunity
to initialize your system from a configuration file.
See Also: UnitTestManager author: Michael Stover (mstover1 at apache.org) version: $Revision: 584560 $ |
Method Summary | |
protected static void | initializeLogging(String[] args) An overridable method that initializes the logging for the unit test run,
using the properties file passed in as the second argument. | protected static void | initializeManager(String[] args) An overridable method that that instantiates a UnitTestManager (if one
was specified in the command-line arguments), and hands it the name of
the properties file to use to configure the system. | public static void | main(String[] args) Starts a run through all unit tests found in the specified classpaths.
The first argument should be a list of paths to search. | public static TestSuite | suite() |
initializeLogging | protected static void initializeLogging(String[] args)(Code) | | An overridable method that initializes the logging for the unit test run,
using the properties file passed in as the second argument.
Parameters: args - |
initializeManager | protected static void initializeManager(String[] args)(Code) | | An overridable method that that instantiates a UnitTestManager (if one
was specified in the command-line arguments), and hands it the name of
the properties file to use to configure the system.
Parameters: args - |
main | public static void main(String[] args)(Code) | | Starts a run through all unit tests found in the specified classpaths.
The first argument should be a list of paths to search. The second
argument is optional and specifies a properties file used to initialize
logging. The third argument is also optional, and specifies a class that
implements the UnitTestManager interface. This provides a means of
initializing your application with a configuration file prior to the
start of any unit tests.
Parameters: args - the command line arguments |
suite | public static TestSuite suite()(Code) | | |
|
|