|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sourceforge.jwebunit.WebTester
Provides a high-level API for basic web application navigation and validation by wrapping HttpUnit and providing Junit assertions. It supports use of a property file for web resources (ala Struts), though a resource file for the app is not required.
| Constructor Summary | |
WebTester()
|
|
| Method Summary | |
void |
assertButtonNotPresent(java.lang.String buttonId)
Assert that a button with a given id is not present. |
void |
assertButtonPresent(java.lang.String buttonId)
Assert that a button with a given id is present. |
void |
assertCheckboxNotSelected(java.lang.String checkBoxName)
Assert that a specific checkbox is not selected. |
void |
assertCheckboxSelected(java.lang.String checkBoxName)
Assert that a specific checkbox is selected. |
void |
assertElementNotPresent(java.lang.String anID)
Assert that an element with a given id is not present. |
void |
assertElementPresent(java.lang.String anID)
Assert that an element with a given id is present. |
void |
assertFormElementEmpty(java.lang.String formElementName)
Assert that a form element had no value / is empty. |
void |
assertFormElementEquals(java.lang.String formElementName,
java.lang.String expectedValue)
Assert that a specific form element has an expected value. |
void |
assertFormElementNotPresent(java.lang.String formElementName)
Assert that a form input element with a given name is not present. |
void |
assertFormElementNotPresentWithLabel(java.lang.String formElementLabel)
Assert that a form input element with a given label is not present. |
void |
assertFormElementPresent(java.lang.String formElementName)
Assert that a form input element with a given name is present. |
void |
assertFormElementPresentWithLabel(java.lang.String formElementLabel)
Assert that a form input element with a given label is present. |
void |
assertFormPresent()
Assert that there is a form present. |
void |
assertFormPresent(java.lang.String nameOrID)
Assert that there is a form with the specified name or id present. |
void |
assertFramePresent(java.lang.String frameName)
Assert that a frame with the given name is present. |
void |
assertKeyInTable(java.lang.String tableSummaryOrId,
java.lang.String key)
Assert that the value of a given web resource is present in a specific table. |
void |
assertKeyNotInTable(java.lang.String tableSummaryOrId,
java.lang.String key)
Assert that the value of a given web resource is not present in a specific table. |
void |
assertKeyNotPresent(java.lang.String key)
Assert that a web resource's value is not present. |
void |
assertKeyPresent(java.lang.String key)
Assert that a web resource's value is present. |
void |
assertKeysInTable(java.lang.String tableSummaryOrId,
java.lang.String[] keys)
Assert that the values of a set of web resources are all present in a specific table. |
void |
assertLinkNotPresent(java.lang.String linkId)
Assert that no link with the given id is present in the response. |
void |
assertLinkNotPresentWithImage(java.lang.String imageFileName)
Assert that a link containing a specified image is not present. |
void |
assertLinkNotPresentWithText(java.lang.String linkText)
Assert that no link containing the supplied text is present. |
void |
assertLinkPresent(java.lang.String linkId)
Assert that a link with a given id is present in the response. |
void |
assertLinkPresentWithImage(java.lang.String imageFileName)
Assert that a link containing a specified image is present. |
void |
assertLinkPresentWithText(java.lang.String linkText)
Assert that a link containing the supplied text is present. |
void |
assertOptionEquals(java.lang.String selectName,
java.lang.String option)
Assert that the currently selected display value of a select box matches a given value. |
void |
assertOptionsEqual(java.lang.String selectName,
java.lang.String[] expectedOptions)
Assert that the display values of a select element's options match a given array of strings. |
void |
assertOptionsNotEqual(java.lang.String selectName,
java.lang.String[] expectedOptions)
Assert that the display values of a select element's options do not match a given array of strings. |
void |
assertOptionValuesEqual(java.lang.String selectName,
java.lang.String[] expectedValues)
Assert that the values of a select element's options match a given array of strings. |
void |
assertOptionValuesNotEqual(java.lang.String selectName,
java.lang.String[] optionValues)
Assert that the values of a select element's options do not match a given array of strings. |
void |
assertRadioOptionNotPresent(java.lang.String name,
java.lang.String radioOption)
Assert that a specific option is not present in a radio group. |
void |
assertRadioOptionNotSelected(java.lang.String name,
java.lang.String radioOption)
Assert that a specific option is not selected in a radio group. |
void |
assertRadioOptionPresent(java.lang.String name,
java.lang.String radioOption)
Assert that a specific option is present in a radio group. |
void |
assertRadioOptionSelected(java.lang.String name,
java.lang.String radioOption)
Assert that a specific option is selected in a radio group. |
void |
assertSubmitButtonNotPresent(java.lang.String buttonName)
Assert that a submit button with a given name is not present. |
void |
assertSubmitButtonPresent(java.lang.String buttonName)
Assert that a submit button with a given name is present. |
void |
assertSubmitButtonValue(java.lang.String buttonName,
java.lang.String expectedValue)
Assert that a submit button with a given name and value is present. |
void |
assertTableEquals(java.lang.String tableSummaryOrId,
ExpectedTable expectedTable)
Assert that a specific table matches an ExpectedTable. |
void |
assertTableEquals(java.lang.String tableSummaryOrId,
java.lang.String[][] expectedCellValues)
Assert that a specific table matches a matrix of supplied text values. |
void |
assertTableNotPresent(java.lang.String tableSummaryOrId)
Assert that a table with a given summary or id value is not present. |
void |
assertTablePresent(java.lang.String tableSummaryOrId)
Assert that a table with a given summary or id value is present. |
void |
assertTableRowsEqual(java.lang.String tableSummaryOrId,
int startRow,
ExpectedTable expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied text values. |
void |
assertTableRowsEqual(java.lang.String tableSummaryOrId,
int startRow,
java.lang.String[][] expectedCellValues)
Assert that a range of rows for a specific table matches a matrix of supplied text values. |
void |
assertTextInElement(java.lang.String elementID,
java.lang.String text)
Assert that a given element contains specific text. |
void |
assertTextInTable(java.lang.String tableSummaryOrId,
java.lang.String text)
Assert that supplied text is present in a specific table. |
void |
assertTextInTable(java.lang.String tableSummaryOrId,
java.lang.String[] text)
Assert that a set of text values are all present in a specific table. |
void |
assertTextNotInTable(java.lang.String tableSummaryOrId,
java.lang.String text)
Assert that supplied text is not present in a specific table. |
void |
assertTextNotInTable(java.lang.String tableSummaryOrId,
java.lang.String[] text)
Assert that none of a set of text values are present in a specific table. |
void |
assertTextNotPresent(java.lang.String text)
Assert that supplied text is not present. |
void |
assertTextPresent(java.lang.String text)
Assert that supplied text is present. |
void |
assertTitleEquals(java.lang.String title)
Assert title of current html page in conversation matches an expected value. |
void |
assertTitleEqualsKey(java.lang.String titleKey)
Assert title of current html page matches the value of a specified web resource. |
void |
assertWindowPresent(java.lang.String windowName)
Assert that a window with the given name is open. |
void |
beginAt(java.lang.String relativeURL)
Begin conversation at a url relative to the application root. |
void |
checkCheckbox(java.lang.String checkBoxName)
Select a specified checkbox. |
void |
clickButton(java.lang.String buttonId)
Click the button with the given id. |
void |
clickLink(java.lang.String linkId)
Navigate by selection of a link with given id. |
void |
clickLinkWithImage(java.lang.String imageFileName)
Navigate by selection of a link with a given image. |
void |
clickLinkWithText(java.lang.String linkText)
Navigate by selection of a link containing given text. |
void |
dumpResponse(java.io.PrintStream stream)
Dump html of current response to a specified stream - for debugging purposes. |
void |
dumpTable(java.lang.String tableNameOrId,
java.io.PrintStream stream)
Dump the table as the 2D array that is used for assertions - for debugging purposes. |
void |
dumpTable(java.lang.String tableNameOrId,
java.lang.String[][] table)
Dump the table as the 2D array that is used for assertions - for debugging purposes. |
void |
dumpTable(java.lang.String tableNameOrId,
java.lang.String[][] table,
java.io.PrintStream stream)
Dump the table as the 2D array that is used for assertions - for debugging purposes. |
HttpUnitDialog |
getDialog()
Provides access to the httpunit wrapper for subclasses - in case functionality not yet wrappered required by test. |
java.lang.String |
getMessage(java.lang.String key)
Return the value of a web resource based on its key. |
TestContext |
getTestContext()
Provide access to test context. |
void |
gotoFrame(java.lang.String frameName)
Make the named frame active (current response will be frame's contents). |
void |
gotoRootWindow()
Make the root window active. |
void |
gotoWindow(java.lang.String windowName)
Make a given window active (current response will be window's contents). |
void |
reset()
Reset the current form. |
void |
selectOption(java.lang.String selectName,
java.lang.String option)
Select an option with a given display value in a select element. |
void |
setFormElement(java.lang.String formElementName,
java.lang.String value)
Set the value of a form input element. |
protected void |
setFormElementWithLabel(java.lang.String formElementLabel,
java.lang.String value)
Set the value of a form input element. |
void |
setWorkingForm(java.lang.String nameOrId)
Begin interaction with a specified form. |
void |
submit()
Submit form - default submit button will be used (unnamed submit button, or named button if there is only one on the form. |
void |
submit(java.lang.String buttonName)
Submit form by pressing named button. |
void |
uncheckCheckbox(java.lang.String checkBoxName)
Deselect a specified checkbox. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WebTester()
| Method Detail |
public HttpUnitDialog getDialog()
public TestContext getTestContext()
public void beginAt(java.lang.String relativeURL)
relativeURL - public java.lang.String getMessage(java.lang.String key)
key - name of the web resource.public void assertTitleEquals(java.lang.String title)
title - expected title valuepublic void assertTitleEqualsKey(java.lang.String titleKey)
titleKey - web resource key for titlepublic void assertKeyPresent(java.lang.String key)
key - web resource namepublic void assertTextPresent(java.lang.String text)
text - public void assertKeyNotPresent(java.lang.String key)
key - web resource namepublic void assertTextNotPresent(java.lang.String text)
text - public void assertTablePresent(java.lang.String tableSummaryOrId)
tableSummaryOrId - summary or id attribute value of tablepublic void assertTableNotPresent(java.lang.String tableSummaryOrId)
tableSummaryOrId - summary or id attribute value of table
public void assertKeyInTable(java.lang.String tableSummaryOrId,
java.lang.String key)
tableSummaryOrId - summary or id attribute value of tablekey - web resource name
public void assertTextInTable(java.lang.String tableSummaryOrId,
java.lang.String text)
tableSummaryOrId - summary or id attribute value of tabletext -
public void assertKeysInTable(java.lang.String tableSummaryOrId,
java.lang.String[] keys)
tableSummaryOrId - summary or id attribute value of tablekeys - Array of web resource names.
public void assertTextInTable(java.lang.String tableSummaryOrId,
java.lang.String[] text)
tableSummaryOrId - summary or id attribute value of tabletext - Array of expected text values.
public void assertKeyNotInTable(java.lang.String tableSummaryOrId,
java.lang.String key)
tableSummaryOrId - summary or id attribute value of tablekey - web resource name
public void assertTextNotInTable(java.lang.String tableSummaryOrId,
java.lang.String text)
tableSummaryOrId - summary or id attribute value of tabletext -
public void assertTextNotInTable(java.lang.String tableSummaryOrId,
java.lang.String[] text)
tableSummaryOrId - summary or id attribute value of tabletext - Array of text values
public void assertTableEquals(java.lang.String tableSummaryOrId,
ExpectedTable expectedTable)
tableSummaryOrId - summary or id attribute value of tableexpectedTable - represents expected values (colspan supported).
public void assertTableEquals(java.lang.String tableSummaryOrId,
java.lang.String[][] expectedCellValues)
tableSummaryOrId - summary or id attribute value of tableexpectedCellValues - double dimensional array of expected values
public void assertTableRowsEqual(java.lang.String tableSummaryOrId,
int startRow,
ExpectedTable expectedTable)
tableSummaryOrId - summary or id attribute value of tablestartRow - index of start row for comparisonexpectedTable - represents expected values (colspan supported).
public void assertTableRowsEqual(java.lang.String tableSummaryOrId,
int startRow,
java.lang.String[][] expectedCellValues)
tableSummaryOrId - summary or id attribute value of tablestartRow - index of start row for comparisonexpectedCellValues - double dimensional array of expected valuespublic void assertFormElementPresent(java.lang.String formElementName)
formElementName - public void assertFormElementNotPresent(java.lang.String formElementName)
formElementName - public void assertFormElementPresentWithLabel(java.lang.String formElementLabel)
formElementLabel - label preceding form element.setFormElementWithLabel(String,String)public void assertFormElementNotPresentWithLabel(java.lang.String formElementLabel)
formElementLabel - label preceding form element.setFormElementWithLabel(String,String)public void assertFormPresent()
public void assertFormPresent(java.lang.String nameOrID)
nameOrID -
public void assertFormElementEquals(java.lang.String formElementName,
java.lang.String expectedValue)
formElementName - expectedValue - public void assertFormElementEmpty(java.lang.String formElementName)
formElementName - public void assertCheckboxSelected(java.lang.String checkBoxName)
checkBoxName - public void assertCheckboxNotSelected(java.lang.String checkBoxName)
checkBoxName -
public void assertRadioOptionPresent(java.lang.String name,
java.lang.String radioOption)
name - radio group name.radioOption - option to test for.
public void assertRadioOptionNotPresent(java.lang.String name,
java.lang.String radioOption)
name - radio group name.radioOption - option to test for.
public void assertRadioOptionSelected(java.lang.String name,
java.lang.String radioOption)
name - radio group name.radioOption - option to test for selection.
public void assertRadioOptionNotSelected(java.lang.String name,
java.lang.String radioOption)
name - radio group name.radioOption - option to test for selection.
public void assertOptionsEqual(java.lang.String selectName,
java.lang.String[] expectedOptions)
selectName - name of the select element.expectedOptions - expected display values for the select box.
public void assertOptionsNotEqual(java.lang.String selectName,
java.lang.String[] expectedOptions)
selectName - name of the select element.expectedOptions - expected display values for the select box.
public void assertOptionValuesEqual(java.lang.String selectName,
java.lang.String[] expectedValues)
selectName - name of the select element.expectedValues - expected values for the select box.
public void assertOptionValuesNotEqual(java.lang.String selectName,
java.lang.String[] optionValues)
selectName - name of the select element.optionValues - expected values for the select box.
public void assertOptionEquals(java.lang.String selectName,
java.lang.String option)
selectName - name of the select element.option - expected display value of the selected option.public void assertSubmitButtonPresent(java.lang.String buttonName)
buttonName - public void assertSubmitButtonNotPresent(java.lang.String buttonName)
buttonName -
public void assertSubmitButtonValue(java.lang.String buttonName,
java.lang.String expectedValue)
buttonName - expectedValue - public void assertButtonPresent(java.lang.String buttonId)
buttonId - public void assertButtonNotPresent(java.lang.String buttonId)
buttonId - public void assertLinkPresent(java.lang.String linkId)
linkId - public void assertLinkNotPresent(java.lang.String linkId)
linkId - public void assertLinkPresentWithText(java.lang.String linkText)
linkText - public void assertLinkNotPresentWithText(java.lang.String linkText)
linkText - public void assertLinkPresentWithImage(java.lang.String imageFileName)
imageFileName - A suffix of the image's filename; for example, to match
"images/my_icon.png", you could just pass in
"my_icon.png".public void assertLinkNotPresentWithImage(java.lang.String imageFileName)
imageFileName - A suffix of the image's filename; for example, to match
"images/my_icon.png", you could just pass in
"my_icon.png".public void assertElementPresent(java.lang.String anID)
anID - element id to test for.public void assertElementNotPresent(java.lang.String anID)
anID - element id to test for.
public void assertTextInElement(java.lang.String elementID,
java.lang.String text)
elementID - id of element to be inspected.text - to check for.public void assertWindowPresent(java.lang.String windowName)
windowName - public void assertFramePresent(java.lang.String frameName)
frameName - public void setWorkingForm(java.lang.String nameOrId)
nameOrId - name or id of the form to work with.
public void setFormElement(java.lang.String formElementName,
java.lang.String value)
formElementName - name of form element.value -
protected void setFormElementWithLabel(java.lang.String formElementLabel,
java.lang.String value)
Home Address : <input
type='text' name='home_addr' />", "Home Address"
could be used as a label. The label must appear within the associated
<form> tag.formElementLabel - label preceding form element.value - public void checkCheckbox(java.lang.String checkBoxName)
checkBoxName - name of checkbox to be deselected.public void uncheckCheckbox(java.lang.String checkBoxName)
checkBoxName - name of checkbox to be deselected.
public void selectOption(java.lang.String selectName,
java.lang.String option)
selectName - name of select element.option - display value of option to be selected.public void submit()
public void submit(java.lang.String buttonName)
buttonName - name of button to submit form with.public void reset()
public void clickLinkWithText(java.lang.String linkText)
linkText - public void clickButton(java.lang.String buttonId)
buttonId - public void clickLinkWithImage(java.lang.String imageFileName)
imageFileName - A suffix of the image's filename; for example, to match
"images/my_icon.png", you could just pass in
"my_icon.png".public void clickLink(java.lang.String linkId)
linkId - id of linkpublic void gotoWindow(java.lang.String windowName)
windowName - public void gotoRootWindow()
public void gotoFrame(java.lang.String frameName)
frameName - public void dumpResponse(java.io.PrintStream stream)
stream -
public void dumpTable(java.lang.String tableNameOrId,
java.io.PrintStream stream)
tableNameOrId - stream -
public void dumpTable(java.lang.String tableNameOrId,
java.lang.String[][] table)
tableNameOrId - table -
public void dumpTable(java.lang.String tableNameOrId,
java.lang.String[][] table,
java.io.PrintStream stream)
tableNameOrId - table - stream -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||