|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.extensions.awt.script.Step | +--junit.extensions.awt.script.Sequence | +--junit.extensions.awt.script.Script
Provide a structure to encapsulate actions invoked on GUI components and tests performed on those components. Scripts need to be short and concise (and therefore easy to read/write). Extensions don't have to be.
This takes a single filename as a constructor argument.
Use AWTTestCase/AWTTestSuite to generate a suite (auto-generate the
collection).
Fields inherited from class junit.extensions.awt.script.Step |
listeners, parser, STEP_END, STEP_ERROR, STEP_FAILURE, STEP_PROGRESS, STEP_START |
Fields inherited from interface junit.extensions.awt.script.Tags |
TAG_ACTION, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_CLASS, TAG_COMPONENT, TAG_COUNT, TAG_DESC, TAG_EVENT, TAG_FILENAME, TAG_ID, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARENT, TAG_POLL_INTERVAL, TAG_SCRIPT, TAG_SEQUENCE, TAG_STOP_ON_ERROR, TAG_STOP_ON_FAILURE, TAG_TAG, TAG_TERMINATE, TAG_THREADED, TAG_TIMEOUT, TAG_TITLE, TAG_TRIGGER, TAG_TYPE, TAG_VALUE, TAG_WAIT, TAG_WINDOW, TAG_X, TAG_Y |
Constructor Summary | |
Script(ComponentFinder finder,
java.util.HashMap atts)
Create a script included from another. |
|
Script(java.io.File file,
ComponentFinder finder)
Create a script. |
Method Summary | |
ComponentReference |
addComponent(java.awt.Component comp)
Add a new component reference for the given component. |
void |
clear()
Set up a blank script, discarding any current state. |
java.lang.String |
getAttributes()
Attributes to save in script. |
ComponentReference |
getComponentReference(java.awt.Component comp)
Return the reference for the given component, or null if none yet exists. |
ComponentReference |
getComponentReference(java.lang.String name)
Convert the given reference ID into a component reference. |
java.util.Collection |
getComponentReferences()
Returns a collection of all the existing references. |
protected java.lang.String |
getDefaultDescription()
Return a reasonable default description for this script step. |
java.io.File |
getFile()
|
java.lang.String |
getName()
|
java.lang.String |
getUniqueID(ComponentReference ref)
Return a unique reference ID. |
protected java.lang.String |
getUsage()
Returns a string describing the proper XML usage for this class. |
java.lang.String |
getXMLTag()
For use in embedding this script in another. |
boolean |
hasLaunch()
|
boolean |
hasTerminate()
|
static boolean |
isScript(java.io.File file)
Return whether the given file looks like a valid AWT script. |
void |
launch()
Convenience function to run the first step of the script if it's a Launch step. |
void |
load()
Parse the script file and build internal structures. |
protected void |
parseChild(org.w3c.dom.Element el)
|
void |
run()
Make sure we've loaded before running. |
void |
save()
Write the script to file. |
void |
setFile(java.io.File outputFile)
|
void |
terminate()
Convenience function to run the last step of the script if it's a terminate step. |
java.lang.String |
toString()
Return a description of this script step. |
Methods inherited from class junit.extensions.awt.script.Sequence |
addStep, addStep, clearFailures, getContents, getStep, indexOf, parseChildren, removeStep, removeStep, runStep, setStep, size, stateChanged, steps |
Methods inherited from class junit.extensions.awt.script.Step |
addStepListener, createAttributeMap, createStep, createStep, fireStepEnd, fireStepError, fireStepEvent, fireStepEvent, fireStepEvent, fireStepFailure, fireStepProgress, fireStepStart, getDescription, getError, getFailure, getFinder, getResolver, getStopOnError, getStopOnFailure, getTester, parseAttributes, removeStepListener, resolve, resolveTester, setDescription, setError, setFailure, setStopOnError, setStopOnFailure, simpleClassName, toXML, usage, usage |
Methods inherited from class java.lang.Object |
|
Methods inherited from interface junit.extensions.awt.script.StepListener |
stateChanged |
Constructor Detail |
public Script(java.io.File file, ComponentFinder finder)
public Script(ComponentFinder finder, java.util.HashMap atts) throws InvalidScriptException
Method Detail |
public java.lang.String getName()
public java.io.File getFile()
public void setFile(java.io.File outputFile)
public void save() throws java.io.IOException
protected void parseChild(org.w3c.dom.Element el) throws InvalidScriptException
parseChild
in class Sequence
public void load() throws InvalidScriptException, java.io.IOException
public java.lang.String getXMLTag()
getXMLTag
in class Sequence
public java.lang.String getAttributes()
Step
getAttributes
in class Step
public void run() throws java.lang.Throwable
run
in class Step
public java.lang.String getUniqueID(ComponentReference ref)
getUniqueID
in interface Resolver
public java.util.Collection getComponentReferences()
Resolver
getComponentReferences
in interface Resolver
public ComponentReference addComponent(java.awt.Component comp)
addComponent
in interface Resolver
public ComponentReference getComponentReference(java.awt.Component comp)
getComponentReference
in interface Resolver
public ComponentReference getComponentReference(java.lang.String name) throws ComponentNotFoundException
getComponentReference
in interface Resolver
public void clear()
clear
in class Sequence
protected java.lang.String getUsage()
Sequence
getUsage
in class Sequence
protected java.lang.String getDefaultDescription()
Step
getDefaultDescription
in class Sequence
public boolean hasLaunch()
public boolean hasTerminate()
public void launch() throws java.lang.Throwable
public void terminate()
public static boolean isScript(java.io.File file)
public java.lang.String toString()
Step
toString
in class Step
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |