| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.shale.test.htmlunit.AbstractHtmlUnitTestCase
public abstract class AbstractHtmlUnitTestCase
Abstract base class for system integration tests based on HtmlUnit.
 These tests will expect a system property named url to be
 present, which will define the URL (including the context path, but
 without a trailing slash) of the application to be tested.
| Field Summary | |
|---|---|
protected  com.gargoylesoftware.htmlunit.html.HtmlPage | 
page
The most recently retrieved page from the server.  | 
protected  URL | 
url
The calculated URL for the installed "systest" web application.  | 
protected  com.gargoylesoftware.htmlunit.WebClient | 
webClient
The web client for this test case.  | 
| Constructor Summary | |
|---|---|
AbstractHtmlUnitTestCase(String name)
Construct a new instance of this test case.  | 
|
| Method Summary | |
|---|---|
protected  com.gargoylesoftware.htmlunit.html.HtmlBody | 
body()
Return the body element for the most recently retrieved page.  | 
protected  com.gargoylesoftware.htmlunit.html.HtmlElement | 
element(String id)
Return the HTML element with the specified id from the
 most recently retrieved page. | 
protected  com.gargoylesoftware.htmlunit.html.HtmlForm | 
form(String id)
Return the form with the specified id from the most
 recently retrieved page. | 
protected  com.gargoylesoftware.htmlunit.html.HtmlHead | 
head()
Return the head element for the most recently retrieved page.  | 
protected  com.gargoylesoftware.htmlunit.html.HtmlPage | 
link(com.gargoylesoftware.htmlunit.html.HtmlAnchor anchor)
Click the specified hyperlink, and retrieve the subsequent page, saving a reference so that other utility methods may be used to retrieve information from it.  | 
protected  com.gargoylesoftware.htmlunit.html.HtmlPage | 
page()
Return the currently stored page reference.  | 
protected  com.gargoylesoftware.htmlunit.html.HtmlPage | 
page(String path)
Retrieve and return the page at the specified context relative path.  | 
protected  void | 
reset(com.gargoylesoftware.htmlunit.html.HtmlPage page)
Reset the stored page reference to the specified value.  | 
protected  void | 
setUp()
Set up the instance variables required for this test case.  | 
protected  com.gargoylesoftware.htmlunit.html.HtmlPage | 
submit(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput submit)
Submit the current page, using the specified component, and retrieve the subsequent page, saving a reference so that other utility methods may be used to retrieve information from it.  | 
static junit.framework.Test | 
suite()
Return the set of tests included in this test suite.  | 
protected  void | 
tearDown()
Tear down instance variables required by this test case.  | 
protected  String | 
title()
Return the page title from the most recently retrieved page.  | 
protected  URL | 
url(String path)
Calculate and return an absolute URL for the specified context relative path, which must begin with a '/' character.  | 
| Methods inherited from class junit.framework.TestCase | 
|---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString | 
| Methods inherited from class junit.framework.Assert | 
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected com.gargoylesoftware.htmlunit.html.HtmlPage page
The most recently retrieved page from the server.
protected URL url
The calculated URL for the installed "systest" web application.
 This value is based on a system property named url,
 which must be defined as part of the command line that executes
 each test case.
protected com.gargoylesoftware.htmlunit.WebClient webClient
The web client for this test case.
| Constructor Detail | 
|---|
public AbstractHtmlUnitTestCase(String name)
Construct a new instance of this test case.
name - Name of the new test case| Method Detail | 
|---|
protected void setUp()
              throws Exception
Set up the instance variables required for this test case.
setUp in class junit.framework.TestCaseException - if an error occurspublic static junit.framework.Test suite()
Return the set of tests included in this test suite.
protected void tearDown()
                 throws Exception
Tear down instance variables required by this test case.
tearDown in class junit.framework.TestCaseException
protected com.gargoylesoftware.htmlunit.html.HtmlBody body()
                                                    throws Exception
Return the body element for the most recently retrieved page.
 If there is no such element, return null.
Exception - if an error occurs
protected com.gargoylesoftware.htmlunit.html.HtmlElement element(String id)
                                                          throws Exception
Return the HTML element with the specified id from the
 most recently retrieved page.  If there is no such element, return
 null.
id - Identifier of the requested element.
Exception - if an error occurs
protected com.gargoylesoftware.htmlunit.html.HtmlForm form(String id)
                                                    throws Exception
Return the form with the specified id from the most
 recently retrieved page.  If there is no such form, return
 null.
id - Identifier of the requested form.
Exception - if an error occurs
protected com.gargoylesoftware.htmlunit.html.HtmlHead head()
                                                    throws Exception
Return the head element for the most recently retrieved page.
 If there is no such element, return null.
Exception - if an error occurs
protected com.gargoylesoftware.htmlunit.html.HtmlPage link(com.gargoylesoftware.htmlunit.html.HtmlAnchor anchor)
                                                    throws IOException
Click the specified hyperlink, and retrieve the subsequent page, saving a reference so that other utility methods may be used to retrieve information from it.
anchor - Anchor component to click
IOException - if an input/output error occursprotected com.gargoylesoftware.htmlunit.html.HtmlPage page()
Return the currently stored page reference.
protected com.gargoylesoftware.htmlunit.html.HtmlPage page(String path)
                                                    throws Exception
Retrieve and return the page at the specified context relative path. Save a reference to this page so that other utility methods may be used to retrieve information from it.
path - Context relative path
IllegalArgumentException - if the context relative path
  does not begin with a '/' character
Exception - if a different error occursprotected void reset(com.gargoylesoftware.htmlunit.html.HtmlPage page)
Reset the stored page reference to the specified value. This is useful for scenarios testing resubmit of the same page (simulating the user pressing the back button and then submitting again).
page - Previously saved page to which to reset
protected com.gargoylesoftware.htmlunit.html.HtmlPage submit(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput submit)
                                                      throws IOException
Submit the current page, using the specified component, and retrieve the subsequent page, saving a reference so that other utility methods may be used to retrieve information from it.
submit - Submit button component to click
IOException - if an input/output error occurs
protected String title()
                throws Exception
Return the page title from the most recently retrieved page. Any leading and trailing whitespace will be trimmed.
Exception - if an error occurs
protected URL url(String path)
           throws Exception
Calculate and return an absolute URL for the specified context relative path, which must begin with a '/' character.
path - Context relative path
IllegalArgumentException - if the context relative path
  does not begin with a '/' character
Exception - if a different error ocurs
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||