org.jtiger.framework
Class FixturesRunnerMain

java.lang.Object
  extended by org.jtiger.framework.FixturesRunnerMain

public final class FixturesRunnerMain
extends Object

Provides an entry point into a test execution by using a main method. The main method creates a FixturesRunnerConfig from the command line arguments then delegates to a FixturesRunner instance, which is created by a FixturesRunnerFactory.

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
Author:
Tony Morris

Field Summary
static String ARG_CATEGORIES
          A case-insensitive command line argument which should be followed by one or more arguments that represent the regular expressions of test case categories to execute.
static String ARG_DEFINITION_CLASS
          A case-insensitive command line argument which should be followed by one class name argument that represents the test definition class.
static String ARG_FIXTURE_CLASSES
          A case-insensitive command line argument which should be followed by one or more arguments that represent the class names of the test fixtures to execute.
static String ARG_HALT_ON_FAILURE
          A case-insensitive command line argument which should be followed by no arguments that represents that a test execution should discontinue if a failure is encountered.
static String ARG_JUNIT
          A case-insensitive command line argument which should be followed by no arguments that represents that a test execution will be of JUnit test cases.
static String ARG_RESULT
          A case-insensitive command line argument which should be followed by one argument that represents the class name of the test fixture result handler.
static String ARG_RESULT_PARAMETERS
          A case-insensitive command line argument which should be followed by one or more arguments that represent the parameters to be passed to the test fixture result handler.
static String ARG_SUTD_CLASS
          A case-insensitive command line argument which should be followed by one argument that represents the class name of the test fixture set up and tear down class.
static int RC_HALTED_ON_FAILURE
          The return code of the Java Virtual Machine if ARG_HALT_ON_FAILURE is used and a test case failure occurs.
static int RC_WRONG_USAGE
          The return code of the Java Virtual Machine if the command line arguments are in an incorrect format.
 
Method Summary
static boolean isCorrectFormat(String... args)
          Returns true if the given arguments can be used to execute main method successfully, false otherwise.
static void main(String... args)
          Execute the test run with the given command line arguments.
static void usage()
          Prints usage information to the standard error stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARG_FIXTURE_CLASSES

public static final String ARG_FIXTURE_CLASSES
A case-insensitive command line argument which should be followed by one or more arguments that represent the class names of the test fixtures to execute. By omitting this argument, no test fixtures will be executed.

See Also:
FixturesRunnerConfig.getFixtureClasses(), Constant Field Values

ARG_DEFINITION_CLASS

public static final String ARG_DEFINITION_CLASS
A case-insensitive command line argument which should be followed by one class name argument that represents the test definition class. By omitting this argument, the default implementation will be used. This class should implement the interface TestDefinition, otherwise the default implementation is used.

See Also:
FixturesRunnerConfig.getDefinitionClass(), Constant Field Values

ARG_SUTD_CLASS

public static final String ARG_SUTD_CLASS
A case-insensitive command line argument which should be followed by one argument that represents the class name of the test fixture set up and tear down class. By omitting this argument, the default implementation will be used. This class should implement the interface SetUpTearDown, otherwise the default implementation is used.

See Also:
FixturesRunnerConfig.getSutdClass(), Constant Field Values

ARG_JUNIT

public static final String ARG_JUNIT
A case-insensitive command line argument which should be followed by no arguments that represents that a test execution will be of JUnit test cases. Specifying this argument overrides any value that is set for the ARG_DEFINITION_CLASS or ARG_SUTD_CLASS arguments.

See Also:
Constant Field Values

ARG_HALT_ON_FAILURE

public static final String ARG_HALT_ON_FAILURE
A case-insensitive command line argument which should be followed by no arguments that represents that a test execution should discontinue if a failure is encountered. By omitting this argument, the default value of false will be used.

See Also:
FixturesRunnerConfig.isHaltOnFailure(), Constant Field Values

ARG_CATEGORIES

public static final String ARG_CATEGORIES
A case-insensitive command line argument which should be followed by one or more arguments that represent the regular expressions of test case categories to execute. By omitting this argument, all categories will be executed.

See Also:
FixturesRunnerConfig.getCategories(), Constant Field Values

ARG_RESULT

public static final String ARG_RESULT
A case-insensitive command line argument which should be followed by one argument that represents the class name of the test fixture result handler. This class should implement the interface FixtureResultsHandler, otherwise the default implementation is used.

See Also:
Constant Field Values

ARG_RESULT_PARAMETERS

public static final String ARG_RESULT_PARAMETERS
A case-insensitive command line argument which should be followed by one or more arguments that represent the parameters to be passed to the test fixture result handler.

See Also:
Constant Field Values

RC_WRONG_USAGE

public static final int RC_WRONG_USAGE
The return code of the Java Virtual Machine if the command line arguments are in an incorrect format. This includes passing no command line arguments.

See Also:
Constant Field Values

RC_HALTED_ON_FAILURE

public static final int RC_HALTED_ON_FAILURE
The return code of the Java Virtual Machine if ARG_HALT_ON_FAILURE is used and a test case failure occurs.

See Also:
Constant Field Values
Method Detail

isCorrectFormat

public static boolean isCorrectFormat(String... args)
                               throws ClassNotFoundException
Returns true if the given arguments can be used to execute main method successfully, false otherwise.

Parameters:
args - The arguments to test for a correct format for execution by the main method.
Returns:
true if the given arguments can be used to execute main method successfully, false otherwise.
Throws:
ClassNotFoundException - If the passed class names in the command line arguments cannot be loaded.

main

public static void main(String... args)
Execute the test run with the given command line arguments. This method will cause a forced JVM shut down by calling System.exit only if the passed command line arguments are not in a correct format (or not present at all) or if ARG_HALT_ON_FAILURE has been set and a test failure occurs. It is guaranteed that if isCorrectFormat(String[]) returns true and if ARG_HALT_ON_FAILURE is not passed, that a forced JVM shut down will not occur. Compile-time checked exceptions, which may be thrown during test execution, will be handled by outputting them to the standard error stream.

Parameters:
args - The arguments to execute the test run with.

usage

public static void usage()
Prints usage information to the standard error stream.