|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--com.netriser.xmltestsuite.TestResource | +--com.netriser.xmltestsuite.HttpResource
Provides http and file resources to test objects. Test objects can make http requests and analyse responses.
This class provides a facade to test objects which uses the httpunit and jaxen packages for much of its functionality
This class is instantiated as a singleton using a factory To obtain a instance use
HttpResource ResourceFactory.getHttpResource();
Constructor Summary | |
HttpResource()
This class is instantiated as a singleton using a factory. |
Method Summary | |
void |
generatePageTemplate()
Generates prototype XML fragment baed on the current response and the specified form. |
java.lang.String |
getBaseURL()
Return the url prefix defined by the configuration file. |
com.meterware.httpunit.WebConversation |
getConversation()
Returns the current WebConversation object, WebConversation implements the http requests. |
org.w3c.dom.Document |
getDOM()
Returns an XML Document for the last response. |
org.w3c.dom.Document |
getDOM(com.meterware.httpunit.WebResponse specificResponse)
Returns an XML Document for the specified response. |
com.meterware.httpunit.WebRequest |
getLastRequest()
Return the most recent http request as a WebRequest object. |
com.meterware.httpunit.WebResponse |
getLastResponse()
Return the most recent http response as a WebResponse object. |
com.meterware.httpunit.WebResponse |
getLastResponse(java.lang.String windowName,
java.lang.String frameName)
Return the response in the named window or frame, or, if not defined, the most recent http response, as a WebResponse object. |
com.meterware.httpunit.WebResponse |
getResponse(org.w3c.dom.Element testElement,
java.lang.String querystring)
Gets the response object specified by the url in the TestObject suffixed with a searchParameter. |
com.meterware.httpunit.WebResponse |
getResponse(java.lang.String URL,
java.lang.String querystring)
Gets the response object specified by the url suffixed with a searchParameter. |
void |
saveHTML(com.meterware.httpunit.WebResponse response)
|
void |
setHtmlWarnings(boolean b)
|
void |
setUp()
Configures the internal, httpunit and jaxen resources. |
void |
submitform(org.w3c.dom.Element formElement)
Submit a HTML form using values defined in the specified form Element in the xml configuration file. |
void |
tearDown()
Tidy up the resource after the tests are run |
void |
validatecookies(org.w3c.dom.Element cookies)
Validate the cookies against the test spec. |
void |
validatecookies(org.w3c.dom.Element cookies,
com.meterware.httpunit.WebResponse response2Validate)
Validate the cookies against the test spec. |
void |
validateElement(org.w3c.dom.Element element)
Validate an element in the response against the test spec. |
void |
validateElement(org.w3c.dom.Element element,
com.meterware.httpunit.WebResponse response2Validate)
Validate an element in the response against the test spec. |
void |
validateform(org.w3c.dom.Element formElement,
java.lang.String validatingAttributeName)
Validate the form against the test spec. |
void |
validateframeset(org.w3c.dom.Element framesetElement)
Validate the details of a response using the named frameset Element |
void |
validateframeset(org.w3c.dom.Element framesetElement,
com.meterware.httpunit.WebResponse response2Validate)
Validate the details of a response using the named frameset Element |
void |
validateheaders(org.w3c.dom.Element page)
Validate the http headers and response code against the test spec. |
void |
validateheaders(org.w3c.dom.Element page,
com.meterware.httpunit.WebResponse response2Validate)
Validate the http headers and response code against the test spec. |
void |
validatelinks(org.w3c.dom.Element page)
Recursively alidate all links on the most.recent response |
void |
validatelinks(org.w3c.dom.Element page,
com.meterware.httpunit.WebResponse response2Validate)
Validate all links on the specified response |
Methods inherited from class com.netriser.xmltestsuite.TestResource |
debug, getDebugMode, getVerboseMode, setDebug, setVerbose, useTestResult, verbose |
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 |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpResource()
HttpResource ResourceFactory.getHttpResource();
Method Detail |
public com.meterware.httpunit.WebConversation getConversation()
public com.meterware.httpunit.WebRequest getLastRequest()
public com.meterware.httpunit.WebResponse getLastResponse()
public com.meterware.httpunit.WebResponse getLastResponse(java.lang.String windowName, java.lang.String frameName)
public java.lang.String getBaseURL()
<testSpec baseURL="">
public void setUp()
setUp
in interface TestResourceInterface
setUp
in class TestResource
TestResource.setUp()
public void tearDown()
TestResource
tearDown
in interface TestResourceInterface
tearDown
in class TestResource
TestResource.tearDown()
public void submitform(org.w3c.dom.Element formElement) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException, java.lang.Exception
formElement
- form Element
java.net.MalformedURLException
- URL Error
java.io.IOException
- HTTP Error
org.xml.sax.SAXException
- Error parsing HTML
java.lang.Exception
- Description of Exception
NoResponseToProcess
public com.meterware.httpunit.WebResponse getResponse(org.w3c.dom.Element testElement, java.lang.String querystring)
The response is cached using the element name and can be refered to in test scripts even after subsequent requests.
public org.w3c.dom.Document getDOM() throws NoResponseToProcess, org.xml.sax.SAXException
NoResponseToProcess
org.xml.sax.SAXException
public org.w3c.dom.Document getDOM(com.meterware.httpunit.WebResponse specificResponse) throws NoResponseToProcess, org.xml.sax.SAXException
NoResponseToProcess
org.xml.sax.SAXException
public com.meterware.httpunit.WebResponse getResponse(java.lang.String URL, java.lang.String querystring)
URL
- querystring
-
public void validateform(org.w3c.dom.Element formElement, java.lang.String validatingAttributeName) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
formElement
- form elementvalidatingAttributeName
- "set" or "value"
java.net.MalformedURLException
- URL Error
java.io.IOException
- HTTP Error
org.xml.sax.SAXException
- Error parsing HTML
NoResponseToProcess
public void validatecookies(org.w3c.dom.Element cookies) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
java.net.MalformedURLException
- URL Error
java.io.IOException
- HTTP Error
org.xml.sax.SAXException
- Error parsing HTML
NoResponseToProcess
public void validatecookies(org.w3c.dom.Element cookies, com.meterware.httpunit.WebResponse response2Validate) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
cookies
- response2Validate
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validateheaders(org.w3c.dom.Element page) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
page
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validateheaders(org.w3c.dom.Element page, com.meterware.httpunit.WebResponse response2Validate) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
page
- response2Validate
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validatelinks(org.w3c.dom.Element page) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
page
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validatelinks(org.w3c.dom.Element page, com.meterware.httpunit.WebResponse response2Validate) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
page
- response2Validate
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validateframeset(org.w3c.dom.Element framesetElement) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
java.net.MalformedURLException
- URL Error
java.io.IOException
- HTTP Error
org.xml.sax.SAXException
- Error parsing HTML
NoResponseToProcess
public void validateframeset(org.w3c.dom.Element framesetElement, com.meterware.httpunit.WebResponse response2Validate) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
framesetElement
- response2Validate
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validateElement(org.w3c.dom.Element element) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
element
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
public void validateElement(org.w3c.dom.Element element, com.meterware.httpunit.WebResponse response2Validate) throws NoResponseToProcess, java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
element
- response2Validate
-
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
NoResponseToProcess
validateElement(Element)
public void generatePageTemplate() throws NoResponseToProcess
NoResponseToProcess
public void setHtmlWarnings(boolean b)
public void saveHTML(com.meterware.httpunit.WebResponse response)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |