|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.tools.it.HtmlUnitTestCase
public abstract class HtmlUnitTestCase
This class is useful as base class for JUnit TestCase classes to setup an environment which makes it possible to easily test web pages. First call one of the load methods and then assert on the response object, XML document (@see loadXmlPage), or HTML document (@see loadHtmlPage).
Field Summary | |
---|---|
protected Object |
document
Low-level access to XML document (org.w3c.dom.Document) or HTML document (com.gargoylesoftware.htmlunit.html.HtmlPage). |
protected org.apache.commons.logging.Log |
log
|
protected Map<String,String> |
namespaces
Low-level access to namespace mappings for XPath expressions. |
protected com.gargoylesoftware.htmlunit.WebResponse |
response
Low-level access to WebResponse object. |
protected com.gargoylesoftware.htmlunit.WebClient |
webClient
Low-level access to WebClient object. |
Constructor Summary | |
---|---|
HtmlUnitTestCase()
|
Method Summary | |
---|---|
protected void |
addNamespace(String prefix,
String uri)
Add a namespace mapping for XPath expressions. |
protected void |
assertXPath(String xpathExpr,
String expected)
Assert that XPath expression result matches exactly expected value. |
void |
createClient()
|
protected String |
evalXPath(String xpathExpr)
Returns XPath expression as string. |
protected void |
loadDeleteResponse(String pageURL)
Sends HTTP DELETE request and loads response object. |
protected void |
loadHtmlPage(String pageURL)
Sends HTTP request and parses response as HTML document. |
protected void |
loadPostResponse(String pageURL,
String content)
Sends HTTP POST request and loads response object. |
protected void |
loadPutResponse(String pageURL,
String content)
Sends HTTP PUT request and loads response object. |
protected void |
loadResponse(String pageURL)
Sends HTTP GET request and loads response object. |
protected void |
loadXmlPage(String pageURL)
Sends HTTP request and parses response as XML document. |
void |
reset()
|
protected URL |
setupBaseUrl()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.commons.logging.Log log
protected com.gargoylesoftware.htmlunit.WebClient webClient
protected com.gargoylesoftware.htmlunit.WebResponse response
protected Object document
protected Map<String,String> namespaces
Constructor Detail |
---|
public HtmlUnitTestCase()
Method Detail |
---|
public void createClient() throws Exception
Exception
public void reset() throws Exception
Exception
protected URL setupBaseUrl() throws Exception
Exception
protected void loadResponse(String pageURL) throws Exception
Exception
protected void loadDeleteResponse(String pageURL) throws Exception
Exception
protected void loadPutResponse(String pageURL, String content) throws Exception
Exception
protected void loadPostResponse(String pageURL, String content) throws Exception
Exception
protected void loadHtmlPage(String pageURL) throws Exception
Exception
protected void loadXmlPage(String pageURL) throws Exception
Exception
protected String evalXPath(String xpathExpr) throws Exception
xpathExpr
- XPath expression
Exception
protected void addNamespace(String prefix, String uri) throws Exception
Exception
protected void assertXPath(String xpathExpr, String expected) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |