com.netriser.xmltestsuite
Class BrowserResource

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--com.netriser.xmltestsuite.TestResource
              |
              +--com.netriser.xmltestsuite.BrowserResource
All Implemented Interfaces:
TestResourceInterface

public class BrowserResource
extends TestResource

This object represents a web browser. The settings are initialised from the xml file The default settings are from the xml dtd file

Author:
david

Method Summary
 void setAcceptCookies(java.lang.String acceptCookies)
          Specifies whether HttpUnit should accept and send cookies.
 void setAcceptGzip(java.lang.String acceptGzip)
          Specifies whether a WebClient will be initialized to accept GZIP encoded responses.
 void setApplicationCodeName(java.lang.String applicationCodeName)
          Method setApplicationCodeName.
 void setApplicationName(java.lang.String applicationName)
          Method setApplicationName.
 void setApplicationVersion(java.lang.String applicationVersion)
          Method setApplicationVersion.
 void setAutoRedirect(java.lang.String autoRedirect)
          Determines whether HttpUnit should automatically follow page redirect requests (status 3xx).
 void setAutoRefresh(java.lang.String autoRefresh)
          Specifies whether HttpUnit should automatically follow page refresh requests.
 void setCheckContentLength(java.lang.String checkContentLength)
          Specifies whether HttpUnit should throw an exception when the content length of a message does not match its actual received length.
 void setDefaultCharacterSet(java.lang.String characterSet)
          Sets the default character set for pages which do not specify one and for requests created without HTML sources.
 void setDefaultContentType(java.lang.String contentType)
          Sets the default content type for pages which do not specify one.
 void setExceptionsThrownOnScriptError(java.lang.String throwExceptions)
          Determines whether script errors result in exceptions or warning messages.
 void setImagesTreatedAsAltText(java.lang.String asText)
          If true, tells HttpUnit to treat images with alt attributes as though they were the text value of that attribute in all searches and displays.
 void setLoggingHttpHeaders(java.lang.String enabled)
          If true, tells HttpUnit to log HTTP headers to system output.
 void setMatchesIgnoreCase(java.lang.String ignoreCase)
          If true, text matches in internal methods are case insensitive.
 void setParameterValuesValidated(java.lang.String validated)
          If true, tells HttpUnit to throw an exception on any attempt to set a form parameter to a value which could not be set via the browser.
 void setParser(java.lang.String name)
          Method setParser.
 void setParserWarningsEnabled(java.lang.String enabled)
          If true, tells the parser to display warning messages.
 void setPlatform(java.lang.String platform)
          Method setPlatform.
static void setPostIncludesCharset(boolean postIncludesCharset)
          Determines whether a normal POST request will include the character set in the content-type header.
 void setRedirectDelay(java.lang.String delayInMilliseconds)
          Sets the delay, in milliseconds, before a redirect request is issued.
 void setScreenHeight(java.lang.String availHeight)
          Method setScreenHeight.
 void setScreenWidth(java.lang.String availWidth)
          Method setScreenWidth.
 void setScriptingEnabled(java.lang.String scriptingEnabled)
          Method setScriptingEnabled.
 void setTestErrorIfHttpErrorStatus(java.lang.String enabled)
          If true, WebClient.getResponse throws an exception when it receives an error status.
 void setUp()
          Setup the resource before the tests are run
 void setUserAgent(java.lang.String userAgent)
          Method setUserAgent.
 void tearDown()
          Tidy up the resource after the tests are run
 
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
 

Method Detail

setUp

public void setUp()
Description copied from class: TestResource
Setup the resource before the tests are run

Specified by:
setUp in interface TestResourceInterface
Specified by:
setUp in class TestResource
See Also:
TestResourceInterface.setUp()

tearDown

public void tearDown()
Description copied from class: TestResource
Tidy up the resource after the tests are run

Specified by:
tearDown in interface TestResourceInterface
Specified by:
tearDown in class TestResource
See Also:
TestResourceInterface.tearDown()

setParser

public void setParser(java.lang.String name)
Method setParser.

Parameters:
name - Default is neko; valid values neko|tidy

setApplicationCodeName

public void setApplicationCodeName(java.lang.String applicationCodeName)
Method setApplicationCodeName.

Parameters:
applicationCodeName -

setApplicationName

public void setApplicationName(java.lang.String applicationName)
Method setApplicationName.

Parameters:
applicationName -

setApplicationVersion

public void setApplicationVersion(java.lang.String applicationVersion)
Method setApplicationVersion.

Parameters:
applicationVersion -

setUserAgent

public void setUserAgent(java.lang.String userAgent)
Method setUserAgent.

Parameters:
userAgent -

setPlatform

public void setPlatform(java.lang.String platform)
Method setPlatform.

Parameters:
platform -

setScreenWidth

public void setScreenWidth(java.lang.String availWidth)
Method setScreenWidth.

Parameters:
availWidth -

setScreenHeight

public void setScreenHeight(java.lang.String availHeight)
Method setScreenHeight.

Parameters:
availHeight -

setAcceptCookies

public void setAcceptCookies(java.lang.String acceptCookies)
Specifies whether HttpUnit should accept and send cookies.


setAcceptGzip

public void setAcceptGzip(java.lang.String acceptGzip)
Specifies whether a WebClient will be initialized to accept GZIP encoded responses. The default is true.


setDefaultCharacterSet

public void setDefaultCharacterSet(java.lang.String characterSet)
Sets the default character set for pages which do not specify one and for requests created without HTML sources. By default, HttpUnit uses the HTTP default encoding, iso-8859-1.


setCheckContentLength

public void setCheckContentLength(java.lang.String checkContentLength)
Specifies whether HttpUnit should throw an exception when the content length of a message does not match its actual received length. Defaults to false.


setPostIncludesCharset

public static void setPostIncludesCharset(boolean postIncludesCharset)
Determines whether a normal POST request will include the character set in the content-type header. The default is to include it; however, some older servlet engines (most notably Tomcat 3.1) get confused when they see it.


setDefaultContentType

public void setDefaultContentType(java.lang.String contentType)
Sets the default content type for pages which do not specify one.


setTestErrorIfHttpErrorStatus

public void setTestErrorIfHttpErrorStatus(java.lang.String enabled)
If true, WebClient.getResponse throws an exception when it receives an error status. Defaults to true.


setParserWarningsEnabled

public void setParserWarningsEnabled(java.lang.String enabled)
If true, tells the parser to display warning messages. The default is false (warnings are not shown).


setParameterValuesValidated

public void setParameterValuesValidated(java.lang.String validated)
If true, tells HttpUnit to throw an exception on any attempt to set a form parameter to a value which could not be set via the browser. The default is true (parameters are validated).
Note: this only applies to a WebRequest created after this setting is changed. A request created with this option disabled will not only not be checked for correctness, its parameter submission order will not be guaranteed, and changing parameters will not trigger Javascript onChange / onClick events.


setImagesTreatedAsAltText

public void setImagesTreatedAsAltText(java.lang.String asText)
If true, tells HttpUnit to treat images with alt attributes as though they were the text value of that attribute in all searches and displays. The default is false (image text is generally ignored).


setMatchesIgnoreCase

public void setMatchesIgnoreCase(java.lang.String ignoreCase)
If true, text matches in internal methods are case insensitive. The default is true (matches ignore case). Included for completeness; don't change without good reason.


setLoggingHttpHeaders

public void setLoggingHttpHeaders(java.lang.String enabled)
If true, tells HttpUnit to log HTTP headers to system output. The default is false.


setAutoRedirect

public void setAutoRedirect(java.lang.String autoRedirect)
Determines whether HttpUnit should automatically follow page redirect requests (status 3xx). By default, this is true in order to simulate normal browser operation.


setRedirectDelay

public void setRedirectDelay(java.lang.String delayInMilliseconds)
Sets the delay, in milliseconds, before a redirect request is issued. This may be necessary if the server under some cases where the server performs asynchronous processing which must be completed before the new request can be handled properly, and is taking advantage of slower processing by most user agents. It almost always indicates an error in the server design, and therefore the default delay is zero.


setAutoRefresh

public void setAutoRefresh(java.lang.String autoRefresh)
Specifies whether HttpUnit should automatically follow page refresh requests. By default, this is false, so that programs can verify the redirect page presented to users before the browser switches to the new page. Setting this to true can cause an infinite loop on pages that refresh themselves.


setScriptingEnabled

public void setScriptingEnabled(java.lang.String scriptingEnabled)
Method setScriptingEnabled.

Parameters:
scriptingEnabled -

setExceptionsThrownOnScriptError

public void setExceptionsThrownOnScriptError(java.lang.String throwExceptions)
Determines whether script errors result in exceptions or warning messages.