public class Test extends ActionProducer implements Timeoutable, Outputable, Scenario
java [application options] [jemmy options] org.netbeans.jemmy.Test [full name of test class] [test args]
new Test([test class name]).startTest([test args]);
Modifier and Type | Field and Description |
---|---|
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.
|
Modifier | Constructor and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
actionProduced, getException, getFinished, getResult, produceAction, run, setActionPriority
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static int WRONG_PARAMETERS_STATUS
public static int SCENARIO_EXCEPTION_STATUS
public static int TEST_PASSED_STATUS
protected Timeouts timeouts
protected TestOut output
public Test(java.lang.String testClassName)
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.testClassName
- Full test class namepublic Test(Scenario scenario)
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.scenario
- a test scenarioScenario
protected Test()
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.public static void closeDown(int status)
java.lang.String
.
Can by invoked from test to abort test execution.status
- If 0 - test passed, otherwise failed.TextCompletedException
- all of the time.public static int run(java.lang.String[] argv)
argv
- First element should be a test class name,
all others - test args.public static int run(java.lang.String[] argv, java.io.PrintStream output)
argv
- First element should be a test class name,
all others - test args.output
- Stream to put test output and errput into.public static int run(java.lang.String[] argv, java.io.PrintStream output, java.io.PrintStream errput)
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.public static int run(java.lang.String[] argv, java.io.PrintWriter output)
argv
- First element should be a test class name,
all others - test args.output
- Writer to put test output and errput into.public static int run(java.lang.String[] argv, java.io.PrintWriter output, java.io.PrintWriter errput)
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.public static void main(java.lang.String[] argv)
Test
.
The call might be directly from the command line.argv
- First element should be a test class name,
all others - test args.public Scenario testForName(java.lang.String testName)
testName
- Full test class nameScenario
to launch.Scenario
public void setTimeouts(Timeouts timeouts)
Test
.setTimeouts
in interface Timeoutable
setTimeouts
in class ActionProducer
timeouts
- A collection of timeout assignments.Timeoutable
,
Timeouts
,
getTimeouts()
public Timeouts getTimeouts()
Test
.getTimeouts
in interface Timeoutable
getTimeouts
in class ActionProducer
Timeoutable
,
Timeouts
,
setTimeouts(org.netbeans.jemmy.Timeouts)
public void setOutput(TestOut out)
setOutput
in interface Outputable
setOutput
in class ActionProducer
out
- An object used to identify both output and error
print streams.Outputable
,
TestOut
,
getOutput()
public TestOut getOutput()
getOutput
in interface Outputable
Outputable
,
TestOut
,
setOutput(org.netbeans.jemmy.TestOut)
public int startTest(java.lang.Object param)
param
- Object to be passed into this test's launch(Object) method.public final java.lang.Object launch(java.lang.Object obj)
Scenario
.launch
in interface Action
launch
in class ActionProducer
obj
- An argument object that controls test execution.
This might be a java.lang.String[]
containing
command line arguments.Action
public void printSynopsis()
public final java.lang.String getDescription()
Action
getDescription
in interface Action
getDescription
in interface Waitable
getDescription
in class ActionProducer
ActionProducer
's description.Action
public int runIt(java.lang.Object param)
Test
.runIt
in interface Scenario
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.
Scenario
protected void doSleep(long time)
time
- The sleep time in milliseconds.