|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.jelly.TagSupport
net.sf.jameleon.LocationAwareTagSupport
net.sf.jameleon.JameleonTagSupport
net.sf.jameleon.function.FunctionTag
public abstract class FunctionTag
Represents an abstract function point that does a lot behind the scenes for the function point developer. The following instance variables are described:
The steps to creating an abstract function tag for a plugin are as follows:
store(java.lang.String,int) methodsetupEnvironment(), being sure to call super first. The new behavior should
be to get the corresponding SessionTag for the plug-in if a handle on the application
is kept there. Use the Jelly-provided findAncestorWithClass(class) method to get a handle on the parent
SessionTag. The abstract FunctionTag implementation should set the handle on the application being tested to
a local instance variable for easy manipulation for FunctionTag extenders. If use of the plug-in FunctionTag requires
a handle on the application, then it is good practice to throw a JameleonScriptException if the an ancestor of the
plug-in SessionTag isn't found.To implement a FunctionTag from an existing plugin, the following methods must be implemented:
The following methods help define the behaviour of the function point and should be implemented not at the plugin level, but at the customization layer the user will do:
| Field Summary | |
|---|---|
protected AbstractDataDrivableTag |
addt
|
protected boolean |
breakPoint
Tells the GUI to stop at this functional point |
protected boolean |
expectException
Specifies an exception is expected. |
protected boolean |
expectFailure
Specifies a failure is expected. |
protected FunctionResult |
fResults
The Results for this function |
protected long |
functionDelay
The delay time to use at the end of each functional point |
protected String |
functionId
The id of this function. |
protected File |
lastFileWritten
Deprecated. use getFunctionResults().setErrorFile() instead. |
protected static org.apache.log4j.Logger |
log
|
protected static long |
NO_DELAY
|
protected ArrayList |
params
A list of parameters passed to this functional point via the <param> tag. |
protected boolean |
postcondition
Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed. |
protected boolean |
precondition
Specifies this is a precondition |
protected SessionTag |
st
The parent session tag of this functional point |
protected StateStorer |
state
Stores the state of the application. |
protected TestCaseTag |
tct
The parent test case of this functional point |
protected ParamTypeValidatable |
vpt
|
| Fields inherited from class net.sf.jameleon.JameleonTagSupport |
|---|
attributes, broker, contextVars, fp, unsupportedAttributes |
| Fields inherited from class net.sf.jameleon.LocationAwareTagSupport |
|---|
columnNumber, elementTagName, lineNumber, scriptFileName |
| Fields inherited from class org.apache.commons.jelly.TagSupport |
|---|
body, context, hasTrimmed, parent, shouldTrim |
| Constructor Summary | |
|---|---|
FunctionTag()
|
|
| Method Summary | |
|---|---|
void |
addParam(Object param)
Adds a ParamTag to the list of parameters |
void |
addRequiredAttribute(String attribute)
Adds a required attribute to the macro tag defined for this function point. |
void |
assertEquals(boolean expected,
boolean actual)
Asserts that two booleans are equal. |
void |
assertEquals(boolean expected,
boolean actual,
int assertLevel)
Asserts that two booleans are equal. |
void |
assertEquals(byte expected,
byte actual)
Asserts that two bytes are equal. |
void |
assertEquals(byte expected,
byte actual,
int assertLevel)
Asserts that two bytes are equal. |
void |
assertEquals(char expected,
char actual)
Asserts that two chars are equal. |
void |
assertEquals(char expected,
char actual,
int assertLevel)
Asserts that two chars are equal. |
void |
assertEquals(double expected,
double actual,
double delta)
Asserts that two doubles are equal concerning a delta. |
void |
assertEquals(double expected,
double actual,
double delta,
int assertLevel)
Asserts that two doubles are equal concerning a delta. |
void |
assertEquals(float expected,
float actual,
float delta)
Asserts that two floats are equal concerning a delta. |
void |
assertEquals(float expected,
float actual,
float delta,
int assertLevel)
Asserts that two floats are equal concerning a delta. |
void |
assertEquals(int expected,
int actual)
Asserts that two ints are equal. |
void |
assertEquals(int expected,
int actual,
int assertLevel)
Asserts that two ints are equal. |
void |
assertEquals(long expected,
long actual)
Asserts that two longs are equal. |
void |
assertEquals(long expected,
long actual,
int assertLevel)
Asserts that two longs are equal. |
void |
assertEquals(Object expected,
Object actual)
Asserts that two objects are equal. |
void |
assertEquals(Object expected,
Object actual,
int assertLevel)
Asserts that two objects are equal. |
void |
assertEquals(short expected,
short actual)
Asserts that two shorts are equal. |
void |
assertEquals(short expected,
short actual,
int assertLevel)
Asserts that two shorts are equal. |
void |
assertEquals(String message,
boolean expected,
boolean actual)
Asserts that two booleans are equal. |
void |
assertEquals(String message,
boolean expected,
boolean actual,
int assertLevel)
Asserts that two booleans are equal. |
void |
assertEquals(String message,
byte expected,
byte actual)
Asserts that two bytes are equal. |
void |
assertEquals(String message,
byte expected,
byte actual,
int assertLevel)
Asserts that two bytes are equal. |
void |
assertEquals(String message,
char expected,
char actual)
Asserts that two chars are equal. |
void |
assertEquals(String message,
char expected,
char actual,
int assertLevel)
Asserts that two chars are equal. |
void |
assertEquals(String message,
double expected,
double actual,
double delta)
Asserts that two doubles are equal concerning a delta. |
void |
assertEquals(String message,
double expected,
double actual,
double delta,
int assertLevel)
Asserts that two doubles are equal concerning a delta. |
void |
assertEquals(String message,
float expected,
float actual,
float delta)
Asserts that two floats are equal concerning a delta. |
void |
assertEquals(String message,
float expected,
float actual,
float delta,
int assertLevel)
Asserts that two floats are equal concerning a delta. |
void |
assertEquals(String message,
int expected,
int actual)
Asserts that two ints are equal. |
void |
assertEquals(String message,
int expected,
int actual,
int assertLevel)
Asserts that two ints are equal. |
void |
assertEquals(String message,
long expected,
long actual)
Asserts that two longs are equal. |
void |
assertEquals(String message,
long expected,
long actual,
int assertLevel)
Asserts that two longs are equal. |
void |
assertEquals(String message,
Object expected,
Object actual)
Asserts that two objects are equal. |
void |
assertEquals(String message,
Object expected,
Object actual,
int assertLevel)
Asserts that two objects are equal. |
void |
assertEquals(String message,
short expected,
short actual)
Asserts that two shorts are equal. |
void |
assertEquals(String message,
short expected,
short actual,
int assertLevel)
Asserts that two shorts are equal. |
void |
assertEquals(String expected,
String actual)
Asserts that two Strings are equal. |
void |
assertEquals(String expected,
String actual,
int assertLevel)
Asserts that two Strings are equal. |
void |
assertEquals(String message,
String expected,
String actual)
Asserts that two Strings are equal. |
void |
assertEquals(String message,
String expected,
String actual,
int assertLevel)
Asserts that two Strings are equal. |
void |
assertFalse(boolean condition)
Asserts that a condition is false. |
void |
assertFalse(boolean condition,
int assertLevel)
Asserts that a condition is false. |
void |
assertFalse(String message,
boolean condition)
Asserts that a condition is false. |
void |
assertFalse(String message,
boolean condition,
int assertLevel)
Asserts that a condition is false. |
protected void |
assertMethod(Runnable r)
Deprecated. This method will be removed in the next major release. |
protected void |
assertMethodWithLevel(Runnable r,
int assertLevel)
Runs the run method of a Runnable and records the results appropriately. |
void |
assertNotNull(Object object)
Asserts that an object isn't null. |
void |
assertNotNull(Object object,
int assertLevel)
Asserts that an object isn't null. |
void |
assertNotNull(String message,
Object object)
Asserts that an object isn't null. |
void |
assertNotNull(String message,
Object object,
int assertLevel)
Asserts that an object isn't null. |
void |
assertNotSame(Object expected,
Object actual)
Asserts that two objects refer to the same object. |
void |
assertNotSame(Object expected,
Object actual,
int assertLevel)
Asserts that two objects refer to the same object. |
void |
assertNotSame(String message,
Object expected,
Object actual)
Asserts that two objects refer to the same object. |
void |
assertNotSame(String message,
Object expected,
Object actual,
int assertLevel)
Asserts that two objects refer to the same object. |
void |
assertNull(Object object)
Asserts that an object is null. |
void |
assertNull(Object object,
int assertLevel)
Asserts that an object is null. |
void |
assertNull(String message,
Object object)
Asserts that an object is null. |
void |
assertNull(String message,
Object object,
int assertLevel)
Asserts that an object is null. |
void |
assertRegexMatches(String text,
String regex)
Asserts that given regex matches the provided text |
void |
assertRegexMatches(String text,
String regex,
int assertLevel)
Asserts that given regex matches the provided text |
void |
assertRegexMatches(String message,
String text,
String regex)
Asserts that given regex matches the provided text |
void |
assertRegexMatches(String message,
String text,
String regex,
int assertLevel)
Asserts that given regex matches the provided text |
void |
assertSame(Object expected,
Object actual)
Asserts that two objects refer to the same object. |
void |
assertSame(Object expected,
Object actual,
int assertLevel)
Asserts that two objects refer to the same object. |
void |
assertSame(String message,
Object expected,
Object actual)
Asserts that two objects refer to the same object. |
void |
assertSame(String message,
Object expected,
Object actual,
int assertLevel)
Asserts that two objects refer to the same object. |
void |
assertTextContains(String text,
String textContained)
Asserts that two objects are equal. |
void |
assertTextContains(String text,
String textContained,
int assertLevel)
Asserts that two objects are equal. |
void |
assertTextContains(String message,
String text,
String textContained)
Asserts that two objects are equal. |
void |
assertTextContains(String message,
String text,
String textContained,
int assertLevel)
Asserts text is contained into some given text. |
void |
assertTextEndsWith(String text,
String endingText)
Asserts that the given endingText is at the end of the given text.. |
void |
assertTextEndsWith(String text,
String endingText,
int assertLevel)
Asserts that the given endingText is at the end of the given text.. |
void |
assertTextEndsWith(String message,
String text,
String endingText)
Asserts that the given endingText is at the end of the given text.. |
void |
assertTextEndsWith(String message,
String text,
String endingText,
int assertLevel)
Asserts text is contained into some given text. |
void |
assertTextStartsWith(String text,
String startingText)
Asserts that the given startingText begins the given text.. |
void |
assertTextStartsWith(String text,
String startingText,
int assertLevel)
Asserts that the given startingText begins the given text.. |
void |
assertTextStartsWith(String message,
String text,
String startingText)
Asserts that the given startingText begins the given text.. |
void |
assertTextStartsWith(String message,
String text,
String startingText,
int assertLevel)
Asserts that the given startingText begins the given text.. |
void |
assertTrue(boolean condition)
Asserts that a condition is true. |
void |
assertTrue(boolean condition,
int assertLevel)
Asserts that a condition is true. |
void |
assertTrue(String message,
boolean condition)
Asserts that a condition is true. |
void |
assertTrue(String message,
boolean condition,
int assertLevel)
Asserts that a condition is true. |
protected void |
checkParamTypes()
|
protected void |
cleanUp()
If this method is overridden, it is highly suggested that the super method be called as well. |
protected void |
cleanUpEnvironment()
|
void |
delay()
|
void |
delay(long delayTime)
|
void |
doTag(XMLOutput out)
Simply calls setupEnvironment(), validate(), setup() and testBlock(XMLOutput out). |
void |
fail()
Fails by throwing an AssertionFailedError. |
void |
fail(int assertLevel)
Fails by throwing an AssertionFailedError with a message |
void |
fail(String message)
Fails by throwing an AssertionFailedError with a message |
void |
fail(String message,
int assertLevel)
Fails by throwing an AssertionFailedError with a message |
String |
getFunctionId()
Gets the id of the function being tested. |
FunctionResult |
getFunctionResults()
|
String |
getMatchingRegexText(String text,
String regex,
int matchingGroup)
Gets the matching text found in the given string. |
Object |
getParam(int index)
Gets the nth ParamTag. |
int |
getParamLength()
Gets the number of ParamTags under this tag. |
List |
getParams()
Gets the list of ParamTags under this tag. |
protected void |
getParentTags()
|
SessionTag |
getSessionTag()
|
String |
getStoreToFileName(int event)
Gets the filename to store the state of the application to. |
String |
getStringOrDefault(String value,
String defaultValue)
Gets a String by its default value if an actual value isn't found. |
TestCaseTag |
getTestCaseTag()
Gets the parent test case tag |
Object |
getVariable(String key)
Gets the variable, key from the test case context. |
protected boolean |
getVariableAsBoolean(String key)
|
protected List |
getVariableAsList(String key)
Gets a variable from context and casts it to a list. |
protected String |
getVariableAsString(String key)
|
boolean |
isBreakPoint()
Checks whether this tag is a break point. |
protected boolean |
isContextVariableNull(String key)
Checks to see if the variable, key, is null or hasn't been set. |
void |
pluginTearDown()
Called when the function is done being executed. |
protected void |
recordFunctionResult(long startTime)
Adds the result for this test step into the session's results and logs this information to the logger. |
boolean |
regexMatches(String text,
String regex)
Validates that the provided regex matches the provided text |
protected void |
removeFunctionResult()
|
void |
removeVariable(String key)
Removes the variable, key from the test case context. |
void |
setDefaultVariableValue(String attributeName,
Object attributeValue)
Sets the variable to a default value in the context. |
void |
setDefaultVariableValue(String attributeName,
String attributeValue)
Sets the variable to a default value in the context. |
void |
setExpectException(boolean expectException)
Sets the value for expectException. |
void |
setExpectFailure(boolean expectFailure)
Sets the value for expectFailure. |
void |
setFunctionDelay(long functionDelay)
Sets the delay time to occur at the end of this functional point. |
void |
setFunctionId(String functionId)
Sets the id of the function being tested. |
void |
setup()
Does setup for plugin-required intialization. |
protected void |
setupEnvironment()
This method is called before anything else is called. |
protected void |
setUpFunctionResults()
|
void |
setVariable(String key,
Object value)
Sets the variable, key to the value, value
This is simply a wrapper class for Jelly's own context.setVariable(); |
void |
store(String filename,
int event)
Stores the current state of the object to a given File. |
void |
tearDown()
Called when the function is done being executed. |
void |
testBlock()
Contains the actual testing of the function point. |
protected void |
traceMsg(String msg)
|
protected void |
validate()
This method is called before the testBlock method is called. |
| Methods inherited from class net.sf.jameleon.JameleonTagSupport |
|---|
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught |
| Methods inherited from class net.sf.jameleon.LocationAwareTagSupport |
|---|
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber |
| Methods inherited from class org.apache.commons.jelly.TagSupport |
|---|
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.commons.jelly.Tag |
|---|
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent |
| Field Detail |
|---|
protected FunctionResult fResults
protected String functionId
protected boolean breakPoint
protected boolean precondition
protected boolean postcondition
protected boolean expectFailure
protected boolean expectException
protected File lastFileWritten
protected ArrayList params
protected SessionTag st
protected TestCaseTag tct
protected StateStorer state
protected static org.apache.log4j.Logger log
protected ParamTypeValidatable vpt
protected static final long NO_DELAY
protected long functionDelay
protected AbstractDataDrivableTag addt
| Constructor Detail |
|---|
public FunctionTag()
| Method Detail |
|---|
public String getFunctionId()
public void setFunctionId(String functionId)
functionId - - the id of the function being testedpublic void setExpectFailure(boolean expectFailure)
expectFailure - - set to true to expect a failure. To invoke this functionality must be 'yes' or 'true'.public void setExpectException(boolean expectException)
expectException - - a value of "yes" or "true" indicates the function tag should only pass if there is an exception.public boolean isBreakPoint()
isBreakPoint in interface BreakPointpublic void setFunctionDelay(long functionDelay)
functionDelay - - the time in millis.public void setup()
public void tearDown()
public void pluginTearDown()
public void testBlock()
throws Exception
Exception - when something goes wrong
public void doTag(XMLOutput out)
throws MissingAttributeException
setupEnvironment(), validate(), setup() and testBlock(XMLOutput out).
If this method is overridden, you will need to call super.doTag() or else none of the logging or error reporting will work!
doTag in interface TagMissingAttributeExceptionprotected void cleanUp()
protected void cleanUpEnvironment()
protected void traceMsg(String msg)
public void addRequiredAttribute(String attribute)
attribute - - The name of the attribute to add to the required list.
public void setDefaultVariableValue(String attributeName,
String attributeValue)
attributeName - - the name attribute to setattributeValue - - the value of the attribute to set.net.sf.jameleon.TestCaseTag
public void setDefaultVariableValue(String attributeName,
Object attributeValue)