public class Configuration extends Task
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_HOST |
static int |
DEFAULT_PORT |
protected static int |
DEFAULT_TIMEOUT
The number of seconds before http connections timeout: (default=300)
|
static int |
PORT_HTTP |
static int |
PORT_HTTPS |
static java.lang.String |
PROTOCOL_FILE |
static java.lang.String |
PROTOCOL_HTTP |
static java.lang.String |
PROTOCOL_HTTPS |
description, location, project
Constructor and Description |
---|
Configuration()
Configuration constructor used by instance creation as nested element in ant.
|
Configuration(WebtestTask testSpec)
Configuration constructor used to generate a default configuration when the user omit it.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(Header header) |
void |
addOption(Option option) |
protected java.io.File |
computeSubFolder(java.io.File _resultDir)
Compute the name of the subfolder for this test
|
protected void |
configurePageCreator(com.gargoylesoftware.htmlunit.WebClient webClient)
Configures WebTest's custom page creator able to create PDFPage (as long as this is not integrated
directly into HtmlUnit)
|
com.gargoylesoftware.htmlunit.WebClient |
createWebClient()
Configures the webclient used for the test
|
void |
execute() |
java.lang.String |
getAutoRefresh()
Returns true if the client should automatically follow page refresh requests.
|
java.lang.String |
getBasePath() |
java.lang.String |
getBrowser()
Gets the configured browser
|
Context |
getContext()
Gets the context for the current webtest
|
java.lang.String |
getDefaultPropertyType() |
int |
getEasyAjaxDelay()
Experimental.
|
java.lang.String |
getErrorProperty() |
java.lang.String |
getExternalProperty(java.lang.String name) |
java.lang.String |
getFailureProperty() |
java.util.List |
getHeaderList() |
java.lang.String |
getHost() |
java.util.List |
getOptionList() |
java.util.Map |
getParameterDictionary() |
int |
getPort() |
java.lang.String |
getProtocol() |
java.lang.String |
getResultFile() |
protected int |
getResultFolderIndex(java.io.File _resultDir)
Get the index to use as prefix for the dedicated result folder of this test
|
java.io.File |
getResultpath()
This is the configured general result dir.
|
java.lang.String |
getSavePrefix() |
java.lang.String |
getSslKeyStore() |
java.lang.String |
getSslKeyStorePassword() |
java.lang.String |
getSslKeyStoreType() |
java.lang.String |
getSslTrustStore() |
java.lang.String |
getSslTrustStorePassword() |
java.io.File |
getSummaryFile()
Gets the file where the summary should be written.
|
int |
getTimeout()
Gets the timeout in seconds
|
java.lang.String |
getUrlForPage(java.lang.String page)
Completes a URL based on configuration values by expanding
where needed from a base URL (protocol and optionally
host:port).
|
boolean |
getUseInsecureSSL()
Indicate if insecure SSL should be used, ie that certificates should not be validated
and therefore outdated or self-signed certificates accepted.
|
java.lang.String |
getUserAgent()
Gets the User-Agent header to be sent.
|
java.io.File |
getWebTestResultDir()
Gets the directory where all artifacts of this specific test should be saved.
|
void |
init()
Get's called from Ant once the project and target references have been set
but before the properties are configured
|
boolean |
isEasyAjax() |
boolean |
isHaltOnError() |
boolean |
isHaltOnFailure() |
boolean |
isRespectVisibility()
Experimental: indicates if WebTest tries to work only on displayed elements.
|
boolean |
isSaveResponse() |
boolean |
isShowHtmlParserOutput() |
void |
setAutoRefresh(java.lang.String str)
Determines if the client should automatically follow page refresh requests.
|
void |
setBasepath(java.lang.String newBasePath)
Defines the constant base path used to construct request URLs,
e.g.
|
void |
setBrowser(java.lang.String browser)
Configures the browser that should be simulated in the test
|
void |
setContext(Context context)
Defines the context.
|
void |
setDefaultPropertyType(java.lang.String type) |
void |
setEasyAjax(boolean b)
Experimental.
|
void |
setEasyAjaxDelay(int delay)
Experimental.
|
void |
setErrorProperty(java.lang.String errorProperty) |
void |
setFailureProperty(java.lang.String failureProperty) |
void |
setHaltonerror(boolean haltOnError) |
void |
setHaltonfailure(boolean haltOnFailure) |
void |
setHost(java.lang.String newHost) |
void |
setPort(int newPort) |
void |
setPropertyHandler(IPropertyHandler propertyHandler) |
void |
setProtocol(java.lang.String newProtocol) |
void |
setRespectVisibility(boolean b)
Experimental: indicates if WebTest should try to work only on displayed elements.
|
void |
setResultfile(java.lang.String resultFile) |
void |
setResultFolderIndex(int index)
Sets the index of the result folder.
|
void |
setResultpath(java.io.File newResultPath) |
void |
setSavePrefix(java.lang.String savePrefix) |
void |
setSaveresponse(boolean newSaveResponse) |
void |
setShowhtmlparseroutput(boolean showParserOutput) |
void |
setSslKeyStore(java.lang.String sslKeyStore)
Defines the path of the keystore file that is used to load the certificates for client authentication
|
void |
setSslKeyStorePassword(java.lang.String sslKeyStorePassword) |
void |
setSslKeyStoreType(java.lang.String sslKeyStoreType)
Defines the type of the keystore that is used to load the certificates for client authentication
|
void |
setSslTrustStore(java.lang.String sslTrustStore) |
void |
setSslTrustStorePassword(java.lang.String sslTrustStorePassword) |
void |
setSummary(boolean newSummary) |
void |
setTimeout(int timeout)
Sets the timeout
|
protected void |
setupWebClient() |
void |
setUseInsecureSSL(boolean insecureSSL)
Defines if insecure SSL should be used, ie that certificates should not be validated
and therefore outdated or self-signed certificates accepted.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public static final int PORT_HTTP
public static final int PORT_HTTPS
public static final int DEFAULT_PORT
public static final java.lang.String DEFAULT_HOST
public static final java.lang.String PROTOCOL_HTTP
public static final java.lang.String PROTOCOL_HTTPS
public static final java.lang.String PROTOCOL_FILE
protected static final int DEFAULT_TIMEOUT
public Configuration()
public Configuration(WebtestTask testSpec)
public void init()
public void execute() throws BuildException
execute
in class Task
BuildException
protected void setupWebClient() throws java.io.IOException
java.io.IOException
protected java.io.File computeSubFolder(java.io.File _resultDir)
_resultDir
- the "main" result dirpublic void setResultFolderIndex(int index)
index
- the indexprotected int getResultFolderIndex(java.io.File _resultDir)
_resultDir
- the base result directorypublic java.io.File getSummaryFile()
null
if no resultfile was specifiedpublic void addHeader(Header header)
header
- public java.util.List getHeaderList()
public void addOption(Option option)
option
- public java.util.List getOptionList()
public java.lang.String getBasePath()
public java.lang.String getUserAgent()
null
if none has been configuredpublic java.lang.String getHost()
public int getPort()
public java.lang.String getProtocol()
public java.io.File getResultpath()
public java.io.File getWebTestResultDir()
getResultpath()
but this may change in the future.public java.lang.String getSavePrefix()
public java.lang.String getUrlForPage(java.lang.String page)
page
- the maybe relative target URLpublic boolean isSaveResponse()
public void setSavePrefix(java.lang.String savePrefix)
public void setBasepath(java.lang.String newBasePath)
newBasePath
- the new valuepublic void setHost(java.lang.String newHost)
public void setPort(int newPort)
public void setProtocol(java.lang.String newProtocol)
public void setResultpath(java.io.File newResultPath)
public void setSaveresponse(boolean newSaveResponse)
public void setSummary(boolean newSummary)
public void setHaltonerror(boolean haltOnError)
public void setHaltonfailure(boolean haltOnFailure)
public void setErrorProperty(java.lang.String errorProperty)
public void setFailureProperty(java.lang.String failureProperty)
public java.lang.String getFailureProperty()
public java.lang.String getErrorProperty()
public java.lang.String getDefaultPropertyType()
public void setDefaultPropertyType(java.lang.String type)
public void setShowhtmlparseroutput(boolean showParserOutput)
public boolean isShowHtmlParserOutput()
public boolean isHaltOnFailure()
public boolean isHaltOnError()
public java.util.Map getParameterDictionary()
public java.lang.String getResultFile()
public void setResultfile(java.lang.String resultFile)
public void setPropertyHandler(IPropertyHandler propertyHandler)
public java.lang.String getExternalProperty(java.lang.String name)
public java.lang.String getAutoRefresh()
public void setAutoRefresh(java.lang.String str)
str
- the new refresh valuepublic void setContext(Context context)
execute()
is calledcontext
- the contextpublic Context getContext()
public com.gargoylesoftware.htmlunit.WebClient createWebClient()
protected void configurePageCreator(com.gargoylesoftware.htmlunit.WebClient webClient)
public int getTimeout()
DEFAULT_TIMEOUT
).public void setTimeout(int timeout)
timeout
- the new value (in seconds), set 0
for no timeoutpublic void setEasyAjax(boolean b)
b
- the new valuepublic boolean isEasyAjax()
public void setEasyAjaxDelay(int delay)
setEasyAjax(boolean)
delay
- the new valuepublic int getEasyAjaxDelay()
public void setUseInsecureSSL(boolean insecureSSL)
insecureSSL
- the new valuepublic boolean getUseInsecureSSL()
false
)public java.lang.String getSslKeyStore()
public void setSslKeyStore(java.lang.String sslKeyStore)
sslKeyStore
- public java.lang.String getSslKeyStoreType()
public void setSslKeyStoreType(java.lang.String sslKeyStoreType)
sslKeyStoreType
- public java.lang.String getSslKeyStorePassword()
public void setSslKeyStorePassword(java.lang.String sslKeyStorePassword)
public java.lang.String getSslTrustStore()
public void setSslTrustStore(java.lang.String sslTrustStore)
public java.lang.String getSslTrustStorePassword()
public void setSslTrustStorePassword(java.lang.String sslTrustStorePassword)
public void setRespectVisibility(boolean b)
public boolean isRespectVisibility()
false
public void setBrowser(java.lang.String browser)
browser
- the browser name like "Firefox3" or "FF3"public java.lang.String getBrowser()
null
if nothing has been configured