|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.netbeans.jemmy.ActionProducer
org.netbeans.jemmy.Test
public class Test
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
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
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(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. |
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 . |
Object |
launch(Object obj)
Launch an action. |
static void |
main(String[] argv)
Invoke this Test . |
void |
printSynopsis()
Supposed to be overridden to print a synopsys into test output. |
static int |
run(String[] argv)
Executes a test. |
static int |
run(String[] argv,
PrintStream output)
Executes a test. |
static int |
run(String[] argv,
PrintStream output,
PrintStream errput)
Executes a test. |
static int |
run(String[] argv,
PrintWriter output)
Executes a test. |
static int |
run(String[] argv,
PrintWriter output,
PrintWriter errput)
Executes a test. |
int |
runIt(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(Object param)
Executes test. |
Scenario |
testForName(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, 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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int WRONG_PARAMETERS_STATUS
public static int SCENARIO_EXCEPTION_STATUS
public static int TEST_PASSED_STATUS
protected Timeouts timeouts
protected TestOut output
Constructor Detail |
---|
public Test(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.
Method Detail |
---|
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.
TestCompletedException
- all of the time.public static int run(String[] argv)
argv
- First element should be a test class name,
all others - test args.
public static int run(String[] argv, 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(String[] argv, PrintStream output, 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(String[] argv, 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(String[] argv, PrintWriter output, 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(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(String testName)
testName
- Full test class name
Scenario
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(Object param)
param
- Object to be passed into this test's launch(Object) method.
public final Object launch(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 String getDescription()
Action
getDescription
in interface Action
getDescription
in interface Waitable
getDescription
in class ActionProducer
ActionProducer
's description.Action
public int runIt(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.
- Returns:
- an int that tells something about the execution.
For, example, a status code.
- See Also:
Scenario
protected void doSleep(long time)
time
- The sleep time in milliseconds.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |