|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.jelly.TagSupport net.sf.jameleon.LocationAwareTagSupport net.sf.jameleon.JameleonTagSupport net.sf.jameleon.function.FunctionTag net.sf.jameleon.plugin.httpunit.HttpUnitFunctionTag
public abstract class HttpUnitFunctionTag
An implementation of the HttpUnit plugin for a FunctionTag. Some convience assert methods and other HttpUnit functions
are provided. To get fully access to the HttpUnit API, use the session
instance variable. A problem is known
about links whose target's are set to _new
this plugin. The workaround this for now is to get the WebResponse
from the WebLink
when clicked and use that for all future executions. If it is desired to use this response across multiple
functions, it should be okay to throw in the session.
For function points that will always be used to start the test case, the beginSession() method should be called first.
Field Summary | |
---|---|
protected WebResponse |
currentPage
|
protected String |
httpUnitFrameName
When set, the "current page" is considered to be the frame with this name under the main window. |
protected WebClientListener |
listener
A Client Listener used for logging. |
protected long |
requestTime
The start time of a request |
protected WebConversation |
session
The session that is to be shared among all TestSteps encapsulated within a TestCase. |
Fields inherited from class net.sf.jameleon.function.FunctionTag |
---|
addt, breakPoint, expectException, expectFailure, fResults, functionDelay, functionId, lastFileWritten, log, NO_DELAY, params, postcondition, precondition, st, state, tct, 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 | |
---|---|
HttpUnitFunctionTag()
|
Method Summary | |
---|---|
void |
assertFormElementPresent(String msg,
WebForm form,
String formElementName)
Asserts that a form input element with a given name is present. |
void |
assertFormElementPresent(String msg,
WebForm form,
String formElementName,
int assertLevel)
Asserts that a form input element with a given name is present. |
void |
assertFormElementPresent(WebForm form,
String formElementName)
Asserts that a form input element with a given name is present. |
void |
assertFormElementPresent(WebForm form,
String formElementName,
int assertLevel)
Asserts that a form input element with a given name is present. |
void |
assertFormPresent()
Asserts that there is a form present. |
void |
assertFormPresent(int assertLevel)
Asserts that there is a form present. |
void |
assertFormPresent(String nameOrID)
Asserts that there is a form with the specified name or id present. |
void |
assertFormPresent(String nameOrID,
int assertLevel)
Assert that there is a form with the specified name or id present. |
void |
assertFormPresent(String msg,
String nameOrID)
Assert that there is a form with the specified name or id present. |
void |
assertFormPresent(String msg,
String nameOrID,
int assertLevel)
Assert that there is a form with the specified name or id present. |
void |
assertImageNotPresent(String nameAltTextOrSrc)
Checks that an image with given name, alt text or image source is NOT present in the current html. |
void |
assertImageNotPresent(String nameAltTextOrSrc,
int assertLevel)
Checks that an image with given name, alt text or image source is NOT present in the current html. |
void |
assertImageNotPresent(String msg,
String nameAltTextOrSrc)
Checks that an image with given name, alt text or image source is NOT present in the current html. |
void |
assertImageNotPresent(String msg,
String nameAltTextOrSrc,
int assertLevel)
Checks that an image with given name, alt text or image source is NOT present in the current html. |
void |
assertImagePresent(String nameAltTextOrSrc)
Checks that an image with given name, alt text or image source is present in the current html. |
void |
assertImagePresent(String nameAltTextOrSrc,
int assertLevel)
Checks that an image with given name, alt text or image source is present in the current html. |
void |
assertImagePresent(String msg,
String nameAltTextOrSrc)
Checks that an image with given name, alt text or image source is present in the current html. |
void |
assertImagePresent(String msg,
String nameAltTextOrSrc,
int assertLevel)
Checks that an image with given name, alt text or image source is present in the current html. |
void |
assertLinkPresent(String linkText)
Checks that a link with given text is present in the current html. |
void |
assertLinkPresent(String linkText,
int assertLevel)
Checks that a link with given text is present in the current html. |
void |
assertLinkPresent(String msg,
String linkText)
Checks that a link with given text is present in the current html. |
void |
assertLinkPresent(String msg,
String linkText,
int assertLevel)
Checks that a link with given text is present in the current html. |
void |
assertLinkPresentInTable(String linkText,
String tablePosition,
String tableRow,
String tableColumn)
Checks that a link with given text is present in the specified table. |
void |
assertLinkPresentInTable(String linkText,
String tablePosition,
String tableRow,
String tableColumn,
int assertLevel)
Checks that a link with given text is present in the specified table. |
void |
assertLinkPresentInTable(String msg,
String linkText,
String tablePosition,
String tableRow,
String tableColumn,
int assertLevel)
Checks that a link with given text is present in the specified table. |
void |
assertOptionDisplayContains(String msg,
String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type is contained the text desired. |
void |
assertOptionDisplayContains(String msg,
String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type is contained the text desired. |
void |
assertOptionDisplayContains(String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type is contained the text desired. |
void |
assertOptionDisplayContains(String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type is contained the text desired. |
void |
assertOptionDisplayEndsWith(String msg,
String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type ends with the text desired. |
void |
assertOptionDisplayEndsWith(String msg,
String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type ends with the text desired. |
void |
assertOptionDisplayEndsWith(String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type ends with the text desired. |
void |
assertOptionDisplayEndsWith(String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type ends with the text desired. |
void |
assertOptionDisplayEquals(String msg,
String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type equals the text desired. |
void |
assertOptionDisplayEquals(String msg,
String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type equals the text desired. |
void |
assertOptionDisplayEquals(String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type equals the text desired. |
void |
assertOptionDisplayEquals(String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type equals the text desired. |
void |
assertOptionDisplayStartsWith(String msg,
String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type starts with the text desired. |
void |
assertOptionDisplayStartsWith(String msg,
String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type starts with the text desired. |
void |
assertOptionDisplayStartsWith(String valueDisplayed,
String selectName,
WebForm webForm)
Validates the text displayed in the select or option form type starts with the text desired. |
void |
assertOptionDisplayStartsWith(String valueDisplayed,
String selectName,
WebForm webForm,
int assertLevel)
Validates the text displayed in the select or option form type starts with the text desired. |
void |
assertOptionValueEquals(String msg,
String optionValue,
String selectName,
WebForm webForm)
Validates the value of the option in the select form type is equal to the value desired If the test fails display the given message |
void |
assertOptionValueEquals(String msg,
String optionValue,
String selectName,
WebForm webForm,
int assertLevel)
Validates the value of the option in the select form type is equal to the value desired If the test fails display the given message |
void |
assertOptionValueEquals(String optionValue,
String selectName,
WebForm webForm)
Validates the value of the option in the select form type is equal to the value desired If the test fails display the given message |
void |
assertOptionValueEquals(String optionValue,
String selectName,
WebForm webForm,
int assertLevel)
Validates the value of the option in the select form type is equal to the value desired If the test fails display the given message |
void |
assertTableNotPresent(String tableSummaryOrId)
Asserts that a table with a given summary or id value is not present. |
void |
assertTableNotPresent(String tableSummaryOrId,
int assertLevel)
Asserts that a table with a given summary or id value is not present. |
void |
assertTableNotPresent(String msg,
String tableSummaryOrId)
Asserts that a table with a given summary or id value is not present. |
void |
assertTableNotPresent(String msg,
String tableSummaryOrId,
int assertLevel)
Asserts that a table with a given summary or id value is not present. |
void |
assertTablePresent(String tableSummaryOrId)
Asserts that a table with a given summary or id value is present. |
void |
assertTablePresent(String tableSummaryOrId,
int assertLevel)
Assert that a table with a given summary or id value is present. |
void |
assertTablePresent(String msg,
String tableSummaryOrId)
Asserts that a table with a given summary or id value is present. |
void |
assertTablePresent(String msg,
String tableSummaryOrId,
int assertLevel)
Asserts that a table with a given summary or id value is present. |
void |
assertTextInputEquals(String msg,
String textInputValue,
String textInputName,
WebForm webForm)
Validates the value of the text input field. |
void |
assertTextInputEquals(String msg,
String textInputValue,
String textInputName,
WebForm webForm,
int assertLevel)
Validates the value of the text input field. |
void |
assertTextInputEquals(String textInputValue,
String textInputName,
WebForm webForm)
Validates the value of the text input field. |
void |
assertTextInputEquals(String textInputValue,
String textInputName,
WebForm webForm,
int assertLevel)
Validates the value of the text input field. |
void |
assertTextNotPresent(String text)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String text,
boolean stripHtmlComments)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String text,
int assertLevel)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String text,
int assertLevel,
boolean stripHtmlComments)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String msg,
String text)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String msg,
String text,
boolean stripHtmlComments)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String msg,
String text,
int assertLevel)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextNotPresent(String msg,
String text,
int assertLevel,
boolean stripHtmlComments)
Asserts that the supplied text is not present in the reponse. |
void |
assertTextPresent(String text)
Asserts that supplied text is present. |
void |
assertTextPresent(String text,
boolean stripComments)
Asserts that supplied text is present. |
void |
assertTextPresent(String text,
int assertLevel)
Asserts that supplied text is present. |
void |
assertTextPresent(String text,
int assertLevel,
boolean stripComments)
Asserts that supplied text is present. |
void |
assertTextPresent(String msg,
String text)
Asserts that supplied text is present. |
void |
assertTextPresent(String msg,
String text,
boolean stripComments)
Asserts that supplied text is present. |
void |
assertTextPresent(String msg,
String text,
int assertLevel)
Asserts that supplied text is present. |
void |
assertTextPresent(String msg,
String text,
int assertLevel,
boolean stripComments)
Asserts that supplied text is present. |
void |
assertTitleContains(String titleContains)
Checks that the title of the current html page contains the expected value, title |
void |
assertTitleContains(String titleContains,
int assertLevel)
Checks that the title of the current html page contains the expected value, title |
void |
assertTitleContains(String msg,
String titleContains)
Checks that the title of the current html page contains the expected value, title
If the test fails display the given message |
void |
assertTitleContains(String msg,
String titleContains,
int assertLevel)
Checks that the title of the current html page contains the expected value, title
If the test fails display the given message |
void |
assertTitleEquals(String title)
Checks that the title of the current html page matches the expected value, title |
void |
assertTitleEquals(String title,
boolean trimWhitespace)
Checks that the title of the current html page matches the expected value, title |
void |
assertTitleEquals(String title,
int assertLevel)
Checks that the title of the current html page matches the expected value, title |
void |
assertTitleEquals(String title,
int assertLevel,
boolean trimWhitespace)
Checks that the title of the current html page matches the expected value, title |
void |
assertTitleEquals(String msg,
String title)
Checks that the title of the current html page matches the expected value, title
If the test fails display the given message |
void |
assertTitleEquals(String msg,
String title,
boolean trimWhitespace)
Checks that the title of the current html page matches the expected value, title
If the test fails display the given message |
void |
assertTitleEquals(String msg,
String title,
int assertLevel)
Checks that the title of the current html page matches the expected value, title
If the test fails display the given message |
void |
assertTitleEquals(String msg,
String title,
int assertLevel,
boolean trimWhitespace)
Checks that the title of the current html page matches the expected value, title
If the test fails display the given message |
void |
assertTitleNotEquals(String title)
Checks that the title of the current html page does not matche the expected value, title |
void |
assertTitleNotEquals(String title,
int assertLevel)
Checks that the title of the current html page does not matche the expected value, title |
void |
assertTitleNotEquals(String msg,
String title)
Checks that the title of the current html page does not matche the expected value, title
If the test fails display the given message |
void |
assertTitleNotEquals(String msg,
String title,
int assertLevel)
Checks that the title of the current html page does not matche the expected value, title
If the test fails display the given message |
void |
beginSession()
Begin conversation at a url relative to the application root. |
void |
beginSessionAt(String relativeURL)
Begin conversation at a url relative to the application root. |
void |
clickButton(WebForm form,
String buttonId)
Deprecated. Use clickButtonWithName() or clickButtonWithID() instead. |
void |
clickButtonWithID(WebForm form,
String buttonId)
Click the button with the given id. |
void |
clickButtonWithName(WebForm form,
String buttonName)
Click the button with the given name. |
WebResponse |
clickLink(String link)
Finds a link via the getLink(java.lang.String) method and clicks on it. |
WebResponse |
clickLink(String link,
boolean ignoreTarget)
Finds a link via the getLink(java.lang.String) method and clicks on it. |
WebResponse |
clickLink(WebLink webLink,
boolean ignoreTarget)
Finds a link via the getLink(java.lang.String) method and clicks on it. |
WebResponse |
clickLinkWithId(String linkId)
Navigate by selection of a link with given id. |
WebResponse |
clickLinkWithImage(String altText)
Navigate by selection of a link with a given alt text. |
WebResponse |
clickLinkWithImageSrc(String src)
Navigate by selection of a link with a given src. |
WebResponse |
clickLinkWithText(String linkText)
Navigate by selection of a link containing the given text. |
protected String |
getBaseUrl()
Gets the baseUrl from the context based on the application name, organization ( if set ) and environment. |
WebResponse |
getCurrentPage()
A simple wrapper method to the HttpUnit WebConverstation.getCurrentPage() method. |
String |
getCurrentPageText()
Gets the text of the current response (page). |
WebForm |
getForm(String nameOrId)
Gets the form with the id or the name desired. |
WebConversation |
getHttpSession()
Gets the WebConversation that is shared from the HttpUnitSession (hu-session) |
WebImage |
getImage(String nameIdAltTextOrSrc)
Gets the image with the name, alt text or the image source desired. |
WebLink |
getLink(String text)
Tries to get a link via the following HttpUnit methods in order. |
WebLink |
getLinkInTable(String text,
String tablePosition,
String tableRow,
String tableColumn)
Tries to get a link which is located in the specified table cell via the following HttpUnit methods in order. |
String |
getOptionDisplay(String selectName,
String selectValue,
WebForm form)
Gets a select input type's value displayed text from the option. |
String |
getOptionValue(String selectName,
String valueDisplayed,
WebForm form)
Gets a select input type's value attribute from the value displayed. |
String |
getOptionValueContains(String selectName,
String valueDisplayed,
WebForm form)
Gets a select input type's value attribute from the value displayed. |
String |
getOptionValueEndsWith(String selectName,
String valueDisplayed,
WebForm form)
Gets a select input type's value attribute from the value displayed. |
String |
getOptionValueMatches(String selectName,
String valueDisplayed,
WebForm form)
Gets a select input type's value attribute from the value displayed. |
String |
getOptionValueStartsWith(String selectName,
String valueDisplayed,
WebForm form)
Gets a select input type's value attribute from the value displayed. |
WebResponse |
getResponse(String url)
A simple wrapper method to the session.getResponse() method which throws several exceptions. |
WebTable |
getTable(String index,
WebTable[] tables)
Gets table from table index. |
List |
getTableColumnCells(WebTable table,
String colName)
Searches a table table for a cell containing text colName . |
protected String |
getTrimmedCellText(WebTable table,
int row,
int col)
|
void |
pluginTearDown()
Called when the function is done being executed. |
void |
setFormParameterValueFromContext(WebForm form,
String parameterName,
String contextVariableName,
boolean setOnlyIfNotNull)
submit the form via it's default button |
void |
setHttpUnitFrameName(String frameName)
When set, the "current page" is considered to be the frame with this name under the main window. |
void |
setupEnvironment()
Gets the references of the session and the test results from the parent TestCase This method gets called once all attributes are set from the macro language. |
void |
store(String fName,
int event)
|
void |
submitForm(WebForm form)
submit the form via it's default button |
void |
submitForm(WebForm form,
String buttonName)
submit the form via it's default button |
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 WebConversation session
protected WebResponse currentPage
protected long requestTime
protected String httpUnitFrameName
protected WebClientListener listener
Constructor Detail |
---|
public HttpUnitFunctionTag()
Method Detail |
---|
public void setupEnvironment()
setupEnvironment
in class FunctionTag
public void pluginTearDown()
pluginTearDown
in class FunctionTag
protected String getBaseUrl()
public WebResponse getCurrentPage()
WebConverstation.getCurrentPage()
method. There is a known problem
with getting the current page from the session once a link with the target set to _new
is opened. In this
case, it is best to get the WebResponse
from the WebLink.click()
method and run all tests against that.
public WebConversation getHttpSession()
public WebResponse getResponse(String url)
url
- - the Url required to get
public void beginSession()
public void beginSessionAt(String relativeURL)
relativeURL
- public void store(String fName, int event) throws IOException
store
in interface Storable
store
in class FunctionTag
IOException
public void assertTextInputEquals(String textInputValue, String textInputName, WebForm webForm)
textInputValue
- - The value of the text input field.textInputName
- - The paramenter name of the text input form element.webForm
- - The form that contains the select input type.public void assertTextInputEquals(String textInputValue, String textInputName, WebForm webForm, int assertLevel)
textInputValue
- - The value of the text input field.textInputName
- - The paramenter name of the text input form element.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTextInputEquals(String msg, String textInputValue, String textInputName, WebForm webForm)
message
msg
- - The message to display if text
is not in the response.textInputValue
- - The value of the text input field.textInputName
- - The paramenter name of the text input form element.webForm
- - The form that contains the select input type.public void assertTextInputEquals(String msg, String textInputValue, String textInputName, WebForm webForm, int assertLevel)
message
msg
- - The message to display if text
is not in the response.textInputValue
- - The value of the text input field.textInputName
- - The paramenter name of the text input form element.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionValueEquals(String optionValue, String selectName, WebForm webForm)
message
optionValue
- - The value of option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionValueEquals(String msg, String optionValue, String selectName, WebForm webForm)
message
msg
- - The message to display if text
is not in the response.optionValue
- - The value of option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionValueEquals(String optionValue, String selectName, WebForm webForm, int assertLevel)
message
optionValue
- - The value of option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionValueEquals(String msg, String optionValue, String selectName, WebForm webForm, int assertLevel)
message
msg
- - The message to display if text
is not in the response.optionValue
- - The value of option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayContains(String valueDisplayed, String selectName, WebForm webForm)
message
valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayContains(String msg, String valueDisplayed, String selectName, WebForm webForm)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayContains(String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayContains(String msg, String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayStartsWith(String valueDisplayed, String selectName, WebForm webForm)
message
valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayStartsWith(String msg, String valueDisplayed, String selectName, WebForm webForm)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayStartsWith(String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayStartsWith(String msg, String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayEndsWith(String valueDisplayed, String selectName, WebForm webForm)
message
valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayEndsWith(String msg, String valueDisplayed, String selectName, WebForm webForm)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayEndsWith(String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
valueDisplayed
- - The value displayed by the option field. or the starting text.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayEndsWith(String msg, String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayEquals(String valueDisplayed, String selectName, WebForm webForm)
message
valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayEquals(String msg, String valueDisplayed, String selectName, WebForm webForm)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.public void assertOptionDisplayEquals(String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertOptionDisplayEquals(String msg, String valueDisplayed, String selectName, WebForm webForm, int assertLevel)
message
msg
- - The message to display if text
is not in the response.valueDisplayed
- - The value displayed by the option field.selectName
- - The paramenter name of the select option input.webForm
- - The form that contains the select input type.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertImagePresent(String nameAltTextOrSrc)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
nameAltTextOrSrc
- - The name, alt text or image src of the image to find.public void assertImagePresent(String msg, String nameAltTextOrSrc)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
If the test fails display the given message
msg
- - The message to display if an error occursnameAltTextOrSrc
- - The name, alt text or source of the imagepublic void assertImagePresent(String nameAltTextOrSrc, int assertLevel)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
nameAltTextOrSrc
- - The name, alt text or image src of the image to find.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertImagePresent(String msg, String nameAltTextOrSrc, int assertLevel)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
If the test fails display the given message
msg
- - The message to display if text
is not in the response.nameAltTextOrSrc
- - The name, alt text or image src of the image to find.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertImageNotPresent(String nameAltTextOrSrc)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
nameAltTextOrSrc
- - The name, alt text or image src of the image to find.public void assertImageNotPresent(String msg, String nameAltTextOrSrc)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
If the test fails display the given message
nameAltTextOrSrc
- - The name, alt text or image src of the image to find.msg
- - The message to display if an error occurspublic void assertImageNotPresent(String nameAltTextOrSrc, int assertLevel)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
nameAltTextOrSrc
- - The name, alt text or image src of the image to find.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertImageNotPresent(String msg, String nameAltTextOrSrc, int assertLevel)
getImage(java.lang.String)
for information onw how nameAltTextOrSrc
is used to
find the image.
If the test fails display the given message
msg
- - The message to display if text
is not in the response.nameAltTextOrSrc
- - The name, alt text or image src of the image to find.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertLinkPresent(String linkText)
getLink(java.lang.String)
for information onw how linkText
is used to
find the link.
linkText
- - The text, name, id or alt text to clickpublic void assertLinkPresent(String msg, String linkText)
getLink(java.lang.String)
for information onw how linkText
is used to
find the link.
If the test fails display the given message
msg
- - The message to display if text
is not in the response.linkText
- - The text, name, id or alt text to clickpublic void assertLinkPresent(String linkText, int assertLevel)
getLink(java.lang.String)
for information onw how linkText
is used to
find the link.
linkText
- - The text, name, id or alt text to clickassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertLinkPresent(String msg, String linkText, int assertLevel)
getLink(java.lang.String)
for information onw how linkText
is used to
find the link.
If the test fails display the given message
msg
- - The message to display if text
is not in the response.linkText
- - The text, name, id or alt text to clickassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertLinkPresentInTable(String linkText, String tablePosition, String tableRow, String tableColumn, int assertLevel)
linkText
- - The text, name, id or alt text to clicktablePosition
- - Specifies which table to look intableRow
- - Specifies the row to look intableColumn
- - Specifies the column to look inassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertLinkPresentInTable(String linkText, String tablePosition, String tableRow, String tableColumn)
linkText
- - The text, name, id or alt text to clicktablePosition
- - Specifies which table to look intableRow
- - Specifies the row to look intableColumn
- - Specifies the column to look inpublic void assertLinkPresentInTable(String msg, String linkText, String tablePosition, String tableRow, String tableColumn, int assertLevel)
msg
- - The message to display if text
is not in the response.linkText
- - The text, name, id or alt text to clicktablePosition
- - Specifies which table to look intableRow
- - Specifies the row to look intableColumn
- - Specifies the column to look inassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleEquals(String title)
title
title
- expected title valuepublic void assertTitleEquals(String msg, String title)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.title
- expected title valuepublic void assertTitleEquals(String title, int assertLevel)
title
title
- expected title valueassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleEquals(String msg, String title, int assertLevel)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.title
- expected title valueassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleContains(String titleContains)
title
titleContains
- text expected to be in the titlepublic void assertTitleContains(String msg, String titleContains)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.titleContains
- text expected to be in the titlepublic void assertTitleContains(String titleContains, int assertLevel)
title
titleContains
- text expected to be in the titleassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleContains(String msg, String titleContains, int assertLevel)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.titleContains
- text expected to be in the titleassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleEquals(String title, boolean trimWhitespace)
title
title
- expected title valuetrimWhitespace
- - Set to true if leading and trailing whitespace is not to be included in the compare.public void assertTitleEquals(String msg, String title, boolean trimWhitespace)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.title
- expected title valuetrimWhitespace
- - Set to true if leading and trailing whitespace is not to be included in the compare.public void assertTitleEquals(String title, int assertLevel, boolean trimWhitespace)
title
title
- expected title valueassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
trimWhitespace
- - Set to true if leading and trailing whitespace is not to be included in the compare.public void assertTitleEquals(String msg, String title, int assertLevel, boolean trimWhitespace)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.title
- expected title valueassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
trimWhitespace
- - Set to true if leading and trailing whitespace is not to be included in the compare.public void assertTitleNotEquals(String title)
title
title
- expected title valuepublic void assertTitleNotEquals(String msg, String title)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.title
- expected title valuepublic void assertTitleNotEquals(String title, int assertLevel)
title
title
- expected title valueassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleNotEquals(String msg, String title, int assertLevel)
title
If the test fails display the given message
msg
- - The message to display if text
is not in the response.title
- expected title valueassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTextPresent(String text)
text
- - The text that should be in the responsepublic void assertTextPresent(String msg, String text)
message
msg
- - The message to display if text
is not in the response.text
- - The text that should be in the responsepublic void assertTextPresent(String text, int assertLevel)
text
- - The text that should be in the responseassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTextPresent(String msg, String text, int assertLevel)
message
msg
- - The message to display if text
is not in the response.text
- - The text that should be in the responseassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTextPresent(String text, boolean stripComments)
text
- - The text that should be in the responsestripComments
- - Strip html comments from the test?public void assertTextPresent(String msg, String text, boolean stripComments)
message
msg
- - The message to display if text
is not in the response.text
- - The text that should be in the responsestripComments
- - Strip html comments from the test?public void assertTextPresent(String text, int assertLevel, boolean stripComments)
text
- - The text that should be in the responseassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
stripComments
- - Strip html comments from the test?public void assertTextPresent(String msg, String text, int assertLevel, boolean stripComments)
message
msg
- - The message to display if text
is not in the response.text
- - The text that should be in the responseassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
stripComments
- - Strip html comments from the test?public void assertTextNotPresent(String text)
text
- - the text to NOT be found in the responsepublic void assertTextNotPresent(String msg, String text)
text
- - the text to NOT be found in the responsemsg
- - a message that will be displayed if the test fails.public void assertTextNotPresent(String text, int assertLevel)
text
- - the text to NOT be found in the responseassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTextNotPresent(String msg, String text, int assertLevel)
text
- - the text to NOT be found in the responsemsg
- - a message that will be displayed if the test fails.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTextNotPresent(String text, boolean stripHtmlComments)
text
- - the text to NOT be found in the responsestripHtmlComments
- - whether to strip html comments or
notpublic void assertTextNotPresent(String msg, String text, boolean stripHtmlComments)
text
- - the text to NOT be found in the responsemsg
- - a message that will be displayed if the test fails.stripHtmlComments
- - whether to strip html comments or notpublic void assertTextNotPresent(String text, int assertLevel, boolean stripHtmlComments)
text
- - the text to NOT be found in the responseassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
stripHtmlComments
- - whether to strip html comments or notpublic void assertTextNotPresent(String msg, String text, int assertLevel, boolean stripHtmlComments)
text
- - the text to NOT be found in the responsemsg
- - a message that will be displayed if the test fails.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
stripHtmlComments
- - whether to strip html comments or notpublic void assertTablePresent(String tableSummaryOrId)
tableSummaryOrId
- summary or id attribute value of tablepublic void assertTablePresent(String msg, String tableSummaryOrId)
tableSummaryOrId
- summary or id attribute value of tablemsg
- - a message that will be displayed if the test fails.public void assertTablePresent(String tableSummaryOrId, int assertLevel)
tableSummaryOrId
- summary or id attribute value of tableassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTablePresent(String msg, String tableSummaryOrId, int assertLevel)
msg
- - a message that will be displayed if the test fails.tableSummaryOrId
- summary or id attribute value of tableassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTableNotPresent(String tableSummaryOrId)
tableSummaryOrId
- summary or id attribute value of tablepublic void assertTableNotPresent(String msg, String tableSummaryOrId)
msg
- - a message that will be displayed if the test fails.tableSummaryOrId
- summary or id attribute value of tablepublic void assertTableNotPresent(String tableSummaryOrId, int assertLevel)
tableSummaryOrId
- summary or id attribute value of tableassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertTableNotPresent(String msg, String tableSummaryOrId, int assertLevel)
msg
- - a message that will be displayed if the test fails.tableSummaryOrId
- summary or id attribute value of tableassertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertFormElementPresent(WebForm form, String formElementName)
form
- - The form that should contain the form element.formElementName
- - The name of the form element to check for.public void assertFormElementPresent(String msg, WebForm form, String formElementName)
msg
- - a message that will be displayed if the test fails.form
- - The form that should contain the form element.formElementName
- - The name of the form element to check for.public void assertFormElementPresent(WebForm form, String formElementName, int assertLevel)
form
- - The form that should contain the form element.formElementName
- - The name of the form element to check for.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertFormElementPresent(String msg, WebForm form, String formElementName, int assertLevel)
msg
- - a message that will be displayed if the test fails.form
- - The form that should contain the form element.formElementName
- - The name of the form element to check for.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertFormPresent()
public void assertFormPresent(int assertLevel)
assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertFormPresent(String nameOrID)
nameOrID
- - The name of ID of the form to be found.public void assertFormPresent(String msg, String nameOrID)
msg
- - A Message to be displayed in event of a failure.nameOrID
- - The name of ID of the form to be found.public void assertFormPresent(String nameOrID, int assertLevel)
nameOrID
- - The name of ID of the form to be found.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public void assertFormPresent(String msg, String nameOrID, int assertLevel)
nameOrID
- - The name of ID of the form to be found.msg
- - A Message to be displayed in event of a failure.assertLevel
- - Only run this test under the assertLevel as described in AssertLevel
public String getOptionValue(String selectName, String valueDisplayed, WebForm form)
selectName
- - The parameter name of the select option.valueDisplayed
- - The displayed value of the select input. ( <option value="selectValue
">valueDisplayed
</option>)form
- - The form that contains ths select input type.
public String getOptionValueStartsWith(String selectName, String valueDisplayed, WebForm form)
selectName
- - The parameter name of the select option.valueDisplayed
- - The starting portion of the displayed textform
- - The form that contains ths select input type.
public String getOptionValueEndsWith(String selectName, String valueDisplayed, WebForm form)
selectName
- - The parameter name of the select option.valueDisplayed
- - The ending portion of the displayed textform
- - The form that contains ths select input type.
public String getOptionValueContains(String selectName, String valueDisplayed, WebForm form)
selectName
- - The parameter name of the select option.valueDisplayed
- - Any portion of the displayed textform
- - The form that contains ths select input type.
public String getOptionValueMatches(String selectName, String valueDisplayed, WebForm form)
selectName
- - The parameter name of the select option.valueDisplayed
- - A regular expression to be performed against the displayed textform
- - The form that contains ths select input type.
public String getOptionDisplay(String selectName, String selectValue, WebForm form)
selectName
- - The parameter name of the select option.selectValue
- - The option value attribute. ( <option value="selectValue
">valueDisplayed
</option>)form
- - The form that contains ths select input type.
public String getCurrentPageText()
RuntimeException
- - If there is a communication failure with the server.public void clickButton(WebForm form, String buttonId)
clickButtonWithName()
or clickButtonWithID()
instead.
buttonId
- public void clickButtonWithID(WebForm form, String buttonId)
buttonId
- public void clickButtonWithName(WebForm form, String buttonName)
form
- - the form containing the buttonbuttonName
- - the name of the button to clickpublic WebTable getTable(String index, WebTable[] tables)
public List getTableColumnCells(WebTable table, String colName)
table
for a cell containing text colName
.
Returns all the cell text values in that column, below the first matching cell.
table
- The HttpUnit WebTable to search. Nested tables will not be searched.colName
- The text string (column heading) to be contained within a table cell.
This string will be compared against each table cell's contents, whitespace trimmed.
java.lang.String
) in the same column
as the matched text string colName
; only those cells below the matching cell
are returned.protected String getTrimmedCellText(WebTable table, int row, int col)
public WebForm getForm(String nameOrId)
getFormWithID(String id)
method. If there is no form
then it tries to get the form via HttpUnit's getFormWithName(String name)
method. If there is still no form returned, then it tries to convert the
nameOrID
to an integer and get the nth form on the page.
nameOrId
- - The name or id of the form or index number (as in array) of the form on the page.
The index number represents the nth form in HTML page where 0 is
the first form.
null
if no form is return from the HttpUnit methods mentioned above.public WebImage getImage(String nameIdAltTextOrSrc)
nameIdAltTextOrSrc
- - the name, alt text or src of image to return
public WebLink getLink(String text)
getLinkWith()
- Gets a link with the diplayed text
getLinkWithID()
- Gets a link with the id
attribute set.
getLinkWithImageText
- Gets a link with the alt attribute or alt text.
getLinkWithName()
- Gets a link with the name attribute set.
text
- - The link text or the link id or the alt text or the link name.
null
if no WebLink
is found.public WebLink getLinkInTable(String text, String tablePosition, String tableRow, String tableColumn)
getLinkWith()
- Gets a link with the diplayed text
getLinkWithID()
- Gets a link with the id
attribute set.
getLinkWithImageText
- Gets a link with the alt attribute or alt text.
getLinkWithName()
- Gets a link with the name attribute set.
text
- The link text or the link id or the alt text or the link name.tablePosition
- Identifies which table to look in for the link. This can be a table id, or a table specifier
in the format table->(row,col)subtable->(row,col)subtable->etc.tableRow
- The row of the table to look in for the linktableColumn
- The column of the table to look in for the link
null
if no WebLink
is found.public WebResponse clickLink(String link, boolean ignoreTarget)
getLink(java.lang.String)
method and clicks on it.
link
- - see getLink(java.lang.String)
for more information.ignoreTarget
- - if set, will not open link in new window (if the link has a target).
WebResponse
returned by clicking on the link.public WebResponse clickLink(WebLink webLink, boolean ignoreTarget)
getLink(java.lang.String)
method and clicks on it.
webLink
- - see getLink(java.lang.String)
for more information.ignoreTarget
- - if set, will not open link in new window (if the link has a target).
WebResponse
returned by clicking on the link.public WebResponse clickLink(String link)
getLink(java.lang.String)
method and clicks on it.
link
- - see getLink(java.lang.String)
for more information.
WebResponse
returned by clicking on the link.public WebResponse clickLinkWithId(String linkId)
linkId
- The id attribute defined in the link to click.
WebResponse
returned by clicking on the link.public WebResponse clickLinkWithImage(String altText)
altText
- - The alt text for the image
WebResponse
returned by clicking on the link.public WebResponse clickLinkWithImageSrc(String src)
src
- - The src attribute of an image. This source simply needs to
be in the actual image source. For example, if the image
source was /images/foo/bar.jpg and the src
parameter
was set to /foo, then it would click on the first link
with that matched. If you want more exact behavior, be sure
to pass the full path to the image.
WebResponse
returned by clicking on the link.public WebResponse clickLinkWithText(String linkText)
linkText
- - the text that shows as a link on the browser.
WebResponse
returned by clicking on the link.public void submitForm(WebForm form)
form
- - the form to be submittedpublic void submitForm(WebForm form, String buttonName)
form
- - the form to be submittedbuttonName
- - the name of the button to use to submit the formpublic void setFormParameterValueFromContext(WebForm form, String parameterName, String contextVariableName, boolean setOnlyIfNotNull)
form
- - the form to be submittedparameterName
- - The name of the parameter to set.contextVariableName
- - The name of the variable in the context that will become the value of the parameter name.setOnlyIfNotNull
- - set to true if the variable is only to be set when the value is not null or empty.public void setHttpUnitFrameName(String frameName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |