|
|||||||||
| Home >> All >> abbot >> [ script overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
abbot.script
Class Assert

java.lang.Objectabbot.script.Step
abbot.script.Call
abbot.script.Assert
- All Implemented Interfaces:
- abbot.i18n.Resources, abbot.editor.i18n.Resources, Tags, XMLifiable
- public class Assert
- extends Call
Encapsulate an assertion (or a wait). Usage:
<assert method="[!]assertXXX" args="..." [class="..."]>
<assert method="[!](get|is|has)XXX" component="component_id" value="...">
<wait ... [timeout="..."] [pollInterval="..."]>
The first instance invokes a core assertion provided by the
ComponentTester
class; the class tag is required for assertions based on a class derived
from ComponentTester; the class tag indicates the Component class, not the
Tester class (the appropriate tester class will be derived automatically).
The second format indicates a property check on the given component, and an
expected value must be provided; the method name must start with "is",
"get", or "has".
You can invert the sense of either form of assertion by inserting a '!'
character before the method name, or adding an invert="true"
attribute.
The default timeout for a wait is ten seconds; the default poll interval (sleep time between checking the assertion) is 1/10 second.
| Nested Class Summary |
| Nested classes inherited from class abbot.editor.i18n.Resources |
abbot.editor.i18n.Resources.ResourceLoader |
| Field Summary | |
private static java.lang.String |
ASSERT_USAGE
|
private java.lang.String |
componentID
|
static int |
DEFAULT_INTERVAL
Default interval between checking the assertion in a wait. |
static int |
DEFAULT_TIMEOUT
Default timeout before a wait will indicate failure. |
private java.lang.String |
expectedResult
|
private long |
interval
|
private boolean |
invert
|
private static java.lang.String[] |
prefixes
|
private long |
timeout
|
private boolean |
wait
|
private static java.lang.String |
WAIT_USAGE
|
| Fields inherited from class abbot.script.Call |
|
| Fields inherited from class abbot.script.Step |
|
| Fields inherited from interface abbot.script.Tags |
TAG_ACTION, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_CALL, TAG_CLASS, TAG_CLASSPATH, TAG_COMMENT, TAG_COMPONENT, TAG_COUNT, TAG_DELEGATE, TAG_DESC, TAG_EVENT, TAG_FILENAME, TAG_FORKED, TAG_ID, TAG_INDEX, 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_SLOW, 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_VMARGS, TAG_WAIT, TAG_WINDOW, TAG_X, TAG_Y |
| Fields inherited from interface abbot.editor.i18n.Resources |
bundle, STRINGS_BUNDLE |
| Constructor Summary | |
Assert(abbot.Resolver resolver,
java.util.HashMap attributes)
Construct an assert step from XML. |
|
Assert(abbot.Resolver resolver,
java.lang.String desc,
java.lang.String methodName,
java.lang.String[] args,
java.lang.Class testedClass,
java.lang.String expectedResult,
boolean invert)
Assertion provided by a ComponentTester subclass which operates on a Component subclass. |
|
Assert(abbot.Resolver resolver,
java.lang.String desc,
java.lang.String methodName,
java.lang.String[] args,
java.lang.String expectedResult,
boolean invert)
Assertion provided by the ComponentTester class. |
|
Assert(abbot.Resolver resolver,
java.lang.String desc,
java.lang.String methodName,
java.lang.String[] args,
java.lang.String componentID,
java.lang.String expectedResult,
boolean invert)
Property assertion on Component subclass. |
|
| Method Summary | |
private void |
assertEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Use our own comparison, to get the extended array comparisons. |
private void |
assertNotEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Use our own comparison, to get the extended array comparisons. |
protected void |
doCheck()
Check the assertion. |
java.util.HashMap |
getAttributes()
Attributes to save in script. |
java.lang.String |
getComponentID()
|
protected java.lang.String |
getDefaultDescription()
Return a reasonable default description for this script step. |
java.lang.String |
getExpectedResult()
|
protected java.lang.reflect.Method |
getMethod()
Resolve the method name to an actual method. |
long |
getPollInterval()
|
protected java.lang.Object |
getTarget()
Return the target of the method invocation. |
java.lang.Class |
getTargetClass()
Target might be a Tester, might be a Component. |
private abbot.tester.ComponentTester |
getTester()
|
long |
getTimeout()
|
java.lang.String |
getUsage()
Provide a usage String for this step. |
java.lang.String |
getXMLTag()
Define the XML tag to use for this script step. |
private void |
init(boolean inverted,
java.lang.String value)
The canonical form for a boolean assertion is to return true, and set the invert flag if necessary. |
boolean |
isInverted()
|
static boolean |
isPropertyMethodName(java.lang.String name)
|
boolean |
isWait()
|
private static java.util.HashMap |
patchAttributes(java.util.HashMap map)
Strip inversion from the method name. |
protected void |
runStep()
Run this step. |
void |
setComponentID(java.lang.String id)
|
void |
setExpectedResult(java.lang.String result)
|
void |
setInverted(boolean invert)
|
void |
setPollInterval(long interval)
|
void |
setTimeout(long timeout)
|
void |
setWait(boolean wait)
|
protected java.lang.String |
toString(java.lang.Object obj)
Print out arrays by individual element. |
| Methods inherited from class abbot.script.Call |
getArgs, getArguments, getMethodName, getTargetClassName, invoke, resolveMethod, setArguments, setMethodName, setTargetClassName |
| Methods inherited from class abbot.script.Step |
addAttributes, addContent, createAttributeMap, createStep, createStep, getDescription, getFinder, getResolver, parseStepAttributes, resolve, resolveClass, resolveTester, run, setDescription, setScriptError, simpleClassName, toEditableString, toString, toXML, toXMLString, usage, usage |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
DEFAULT_INTERVAL
public static final int DEFAULT_INTERVAL
- Default interval between checking the assertion in a wait.
- See Also:
- Constant Field Values
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
- Default timeout before a wait will indicate failure.
- See Also:
- Constant Field Values
ASSERT_USAGE
private static final java.lang.String ASSERT_USAGE
- See Also:
- Constant Field Values
WAIT_USAGE
private static final java.lang.String WAIT_USAGE
- See Also:
- Constant Field Values
componentID
private java.lang.String componentID
expectedResult
private java.lang.String expectedResult
invert
private boolean invert
wait
private boolean wait
interval
private long interval
timeout
private long timeout
prefixes
private static final java.lang.String[] prefixes
| Constructor Detail |
Assert
public Assert(abbot.Resolver resolver, java.util.HashMap attributes)
- Construct an assert step from XML.
Assert
public Assert(abbot.Resolver resolver, java.lang.String desc, java.lang.String methodName, java.lang.String[] args, java.lang.String expectedResult, boolean invert)
- Assertion provided by the ComponentTester class.
Assert
public Assert(abbot.Resolver resolver, java.lang.String desc, java.lang.String methodName, java.lang.String[] args, java.lang.Class testedClass, java.lang.String expectedResult, boolean invert)
- Assertion provided by a ComponentTester subclass which operates on a
Component subclass.
Assert
public Assert(abbot.Resolver resolver, java.lang.String desc, java.lang.String methodName, java.lang.String[] args, java.lang.String componentID, java.lang.String expectedResult, boolean invert)
- Property assertion on Component subclass.
| Method Detail |
init
private void init(boolean inverted,
java.lang.String value)
- The canonical form for a boolean assertion is to return true, and set
the invert flag if necessary.
isPropertyMethodName
public static boolean isPropertyMethodName(java.lang.String name)
setWait
public void setWait(boolean wait)
isWait
public boolean isWait()
setPollInterval
public void setPollInterval(long interval)
getPollInterval
public long getPollInterval()
setTimeout
public void setTimeout(long timeout)
getTimeout
public long getTimeout()
getExpectedResult
public java.lang.String getExpectedResult()
setExpectedResult
public void setExpectedResult(java.lang.String result)
isInverted
public boolean isInverted()
setInverted
public void setInverted(boolean invert)
patchAttributes
private static java.util.HashMap patchAttributes(java.util.HashMap map)
- Strip inversion from the method name.
getXMLTag
public java.lang.String getXMLTag()
- Description copied from class:
Step - Define the XML tag to use for this script step.
getUsage
public java.lang.String getUsage()
- Description copied from class:
Step - Provide a usage String for this step.
getDefaultDescription
protected java.lang.String getDefaultDescription()
- Description copied from class:
Step - Return a reasonable default description for this script step.
This value is used in the absence of an explicit description.
- Overrides:
getDefaultDescriptionin classCall
getComponentID
public java.lang.String getComponentID()
setComponentID
public void setComponentID(java.lang.String id)
getAttributes
public java.util.HashMap getAttributes()
- Description copied from class:
Call - Attributes to save in script. FIXME use a hash table
- Overrides:
getAttributesin classCall
getTargetClass
public java.lang.Class getTargetClass() throws InvalidScriptException
- Target might be a Tester, might be a Component. Note that the target
class is the class against which the assertion is being made, not
necessarily the actual target of the method invocation.
- Overrides:
getTargetClassin classCall
getTarget
protected java.lang.Object getTarget() throws abbot.NoSuchReferenceException, InvalidScriptException
doCheck
protected void doCheck()
throws java.lang.Throwable
- Check the assertion. This is exported so that it can be used by
derivatives of Assert (e.g. Wait).
toString
protected java.lang.String toString(java.lang.Object obj)
- Print out arrays by individual element.
assertEquals
private void assertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
- Use our own comparison, to get the extended array comparisons.
assertNotEquals
private void assertNotEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
- Use our own comparison, to get the extended array comparisons.
runStep
protected void runStep()
throws java.lang.Throwable
getTester
private abbot.tester.ComponentTester getTester() throws InvalidScriptException
getMethod
protected java.lang.reflect.Method getMethod() throws InvalidScriptException
- Resolve the method name to an actual method. If it's a property
method, look first on the component, if there is one. If there's no
component, or if the property method is not found, look it up on a
subclass of ComponentTester.
|
|||||||||
| Home >> All >> abbot >> [ script overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC