Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.jemmy
Class Test

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--org.netbeans.jemmy.ActionProducer
                  |
                  +--org.netbeans.jemmy.Test

All Implemented Interfaces:
  Action, Outputable, java.lang.Runnable, Scenario, Timeoutable, Waitable

public class Test
extends ActionProducer
implements Timeoutable, Outputable, Scenario

Jemmy itself provides a way to create tests. Test should implement org.netbeans.jemmy.Scenario interface. Test can be executed from command line:
`java [application options] [jemmy options] org.netbeans.jemmy.Test [full name of test class] [test args]`
Test elso can be executed by one of the run(...) methods or by
`new Test([test class name]).startTest([test args]);`
Timeouts used:
Test.WholeTestTimeout - time for the whole test

Author:
  Alexandre Iline (alexandre.iline@sun.com)

Field Summary
`protected TestOut` | `output` Test output.
`static int` | `SCENARIO_EXCEPTION_STATUS` Status returned by test if exception appeared inside scenario.
`static int` | `TEST_PASSED_STATUS` Positive test status.
`protected Timeouts` | `timeouts` Test timeouts.
`static int` | `WRONG_PARAMETERS_STATUS` Status returned by test if wrong parameter was passed.

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`protected` | `Test()` No argument constructor.
`` | `Test(Scenario scenario)` Constructor for scenarios that require an instance and might require an argument.
`` | `Test(java.lang.String testClassName)` Constructor for tests requiring only a class instance.

Method Summary
`static void` | `closeDown(int status)` Throws TestCompletedException exception.
`protected void` | `doSleep(long time)` Sleeps.
`java.lang.String` | `getDescription()` Returns the description value.
`TestOut` | `getOutput()` Get the streams or writers used for print output.
`Timeouts` | `getTimeouts()` Get the timeouts used by this `Test`.
`java.lang.Object` | `launch(java.lang.Object obj)` Launch an action.
`static void` | `main(java.lang.String[] argv)` Invoke this `Test`.
`void` | `printSynopsis()` Supposed to be overridden to print a synopsys into test output.
`static int` | `run(java.lang.String[] argv)` Executes a test.
`static int` | `run(java.lang.String[] argv, java.io.PrintStream output)` Executes a test.
`static int` | `run(java.lang.String[] argv, java.io.PrintStream output, java.io.PrintStream errput)` Executes a test.
`static int` | `run(java.lang.String[] argv, java.io.PrintWriter output)` Executes a test.
`static int` | `run(java.lang.String[] argv, java.io.PrintWriter output, java.io.PrintWriter errput)` Executes a test.
`int` | `runIt(java.lang.Object param)` Defines a way to execute this `Test`.
`void` | `setOutput(TestOut out)` Set the streams or writers used for print output.
`void` | `setTimeouts(Timeouts timeouts)` Set the timeouts used by this `Test`.
`int` | `startTest(java.lang.Object param)` Executes test.
`Scenario` | `testForName(java.lang.String testName)` Creates an instance of a class named by the parameter.

Methods inherited from class org.netbeans.jemmy.ActionProducer
`actionProduced, getException, getFinished, getResult, produceAction, run, setActionPriority`

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### WRONG_PARAMETERS_STATUS

    public static int WRONG_PARAMETERS_STATUS

  Status returned by test if wrong parameter was passed.

### SCENARIO_EXCEPTION_STATUS

    public static int SCENARIO_EXCEPTION_STATUS

  Status returned by test if exception appeared inside scenario.

### TEST_PASSED_STATUS

    public static int TEST_PASSED_STATUS

  Positive test status.

### timeouts

    protected Timeouts timeouts

  Test timeouts.

### output

    protected TestOut output

  Test output.

Constructor Detail

### Test

    public Test(java.lang.String testClassName)

  Constructor for tests requiring only a class instance. Creates a subclass of `ActionProducer` and `java.lang.Thread` that runs in a separate thread of execution and waits for execution to finish. The current output stream assignments and timeouts are used.
  Parameters:
    `testClassName` - Full test class name

### Test

    public Test(Scenario scenario)

  Constructor for scenarios that require an instance and might require an argument. Creates a subclass of `ActionProducer` and `java.lang.Thread` that runs in a separate thread of execution and waits for execution to finish. The current output stream assignments and timeouts are used.
  Parameters:
    `scenario` - a test scenario
  See Also:
    `Scenario`

### Test

    protected Test()

  No argument constructor. Used by subclasses of this `Test` class. Creates a subclass of `ActionProducer` and `java.lang.Thread` that runs in a separate thread of execution and waits for execution to finish. The current output stream assignments and timeouts are used.

Method Detail

### closeDown

    public static void closeDown(int status)

  Throws TestCompletedException exception. The exception thrown contains a pass/fail status and a short status `java.lang.String`. Can by invoked from test to abort test execution.
  Parameters:
    `status` - If 0 - test passed, otherwise failed.
  Throws:
    `TextCompletedException` - all of the time.

### run

    public static int run(java.lang.String[] argv)

  Executes a test.
  Parameters:
    `argv` - First element should be a test class name, all others - test args.
  Returns:
    test status.

### run

    public static int run(java.lang.String[] argv,
                          java.io.PrintStream output)

  Executes a test.
  Parameters:
    `argv` - First element should be a test class name, all others - test args.
    `output` - Stream to put test output and errput into.
  Returns:
    test status.

### run

    public static int run(java.lang.String[] argv,
                          java.io.PrintStream output,
                          java.io.PrintStream errput)

  Executes a test.
  Parameters:
    `argv` - First element should be a test class name, all others - test args.
    `output` - Stream to put test output into.
    `errput` - Stream to put test errput into.
  Returns:
    test status.

### run

    public static int run(java.lang.String[] argv,
                          java.io.PrintWriter output)

  Executes a test.
  Parameters:
    `argv` - First element should be a test class name, all others - test args.
    `output` - Writer to put test output and errput into.
  Returns:
    test status.

### run

    public static int run(java.lang.String[] argv,
                          java.io.PrintWriter output,
                          java.io.PrintWriter errput)

  Executes a test.
  Parameters:
    `argv` - First element should be a test class name, all others - test args.
    `output` - Writer to put test output into.
    `errput` - Writer to put test errput into.
  Returns:
    test status.

### main

    public static void main(java.lang.String[] argv)

  Invoke this `Test`. The call might be directly from the command line.
  Parameters:
    `argv` - First element should be a test class name, all others - test args.

### testForName

    public Scenario testForName(java.lang.String testName)

  Creates an instance of a class named by the parameter.
  Parameters:
    `testName` - Full test class name
  Returns:
    an instance of the test `Scenario` to launch.
  See Also:
    `Scenario`

### setTimeouts

    public void setTimeouts(Timeouts timeouts)

  Set the timeouts used by this `Test`.
  Specified by:
    `setTimeouts` in interface `Timeoutable`
  Overrides:
    `setTimeouts` in class `ActionProducer`
  Parameters:
    `timeouts` - A collection of timeout assignments.
  See Also:
    `Timeoutable`, `Timeouts`, `getTimeouts()`

### getTimeouts

    public Timeouts getTimeouts()

  Get the timeouts used by this `Test`.
  Specified by:
    `getTimeouts` in interface `Timeoutable`
  Overrides:
    `getTimeouts` in class `ActionProducer`
  See Also:
    `Timeoutable`, `Timeouts`, `setTimeouts(org.netbeans.jemmy.Timeouts)`

### setOutput

    public void setOutput(TestOut out)

  Set the streams or writers used for print output.
  Specified by:
    `setOutput` in interface `Outputable`
  Overrides:
    `setOutput` in class `ActionProducer`
  Parameters:
    `out` - An object used to identify both output and error print streams.
  See Also:
    `Outputable`, `TestOut`, `getOutput()`

### getOutput

    public TestOut getOutput()

  Get the streams or writers used for print output.
  Specified by:
    `getOutput` in interface `Outputable`
  Returns:
    an object containing references to both output and error print streams.
  See Also:
    `Outputable`, `TestOut`, `setOutput(org.netbeans.jemmy.TestOut)`

### startTest

    public int startTest(java.lang.Object param)

  Executes test.
  Parameters:
    `param` - Object to be passed into this test's launch(Object) method.
  Returns:
    test status.

### launch

    public final java.lang.Object launch(java.lang.Object obj)

  Launch an action. Pass arguments to and execute a test `Scenario`.
  Overrides:
    `launch` in class `ActionProducer`
  Parameters:
    `obj` - An argument object that controls test execution. This might be a `java.lang.String[]` containing command line arguments.
  Returns:
    an Integer containing test status.
  See Also:
    `Action`

### printSynopsis

    public void printSynopsis()

  Supposed to be overridden to print a synopsys into test output.

### getDescription

    public final java.lang.String getDescription()

  Description copied from interface: `Action`
  Returns the description value.
  Overrides:
    `getDescription` in class `ActionProducer`
  See Also:
    `Action`

### runIt

    public int runIt(java.lang.Object param)

  Defines a way to execute this `Test`.
  Specified by:
    `runIt` in interface `Scenario`
  Parameters:
    `param` - An object passed to configure the test scenario execution. For example, this parameter might be a `java.lang.String[]`object that lists the command line arguments to the Java application corresponding to a test.``
  Returns:
    an int that tells something about the execution. For, example, a status code.
  See Also:
    `Scenario`

### doSleep

    protected void doSleep(long time)

  Sleeps.
  Parameters:
    `time` - The sleep time in milliseconds.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD