Apache JMeter
2.0.1.20050615

org.apache.jorphan.test
Class AllTests

java.lang.Object
  extended byorg.apache.jorphan.test.AllTests

public final class AllTests
extends Object

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.

Version:
$Revision: 1.27 $
Author:
Michael Stover (mstover1 at apache.org)
See Also:
UnitTestManager

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.
static void main(String[] args)
          Starts a run through all unit tests found in the specified classpaths.
static junit.framework.TestSuite suite()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

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. 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

initializeLogging

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.

Parameters:
args -

initializeManager

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.

Parameters:
args -

suite

public static junit.framework.TestSuite suite()

Apache JMeter
2.0.1.20050615

Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.