|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HTTPScript
A request object which can be executed by
IScriptEngine.execute(request)
method.
An object of this class is created using createGetRequest
or
createPosttRequest
method of IScriptEngine. Once the object is
created, it should be populated as per the requirements of the HTTP protocol
and then executed using IScriptEngine.
IScriptEngine
,
IScriptEngine.createGetRequest(int, String, String, String, int, String)
,
IScriptEngine.createPostRequest(int, String, String, String, int,
String)
Method Summary | |
---|---|
void |
addAsSubTaskTo(int parentId)
To add Sub Task to the parent task |
void |
addByteArrayRequestEntity(byte[] requestEntity)
To add binary request entity to Post method |
org.apache.commons.httpclient.Cookie |
addCookie(java.lang.String cookieName,
java.lang.String cookieValue,
java.lang.String path,
boolean secure)
Each HTTP request sends a set of headers to the server, which helps the server understand the kind of request. |
org.apache.commons.httpclient.Cookie |
addCookie(java.lang.String cookieName,
java.lang.String cookieValue,
java.lang.String path,
java.util.Date expires,
boolean secure)
Each HTTP request sends a set of headers to the server, which helps the server understand the kind of request. |
org.apache.commons.httpclient.Cookie |
addCookie(java.lang.String cookieName,
java.lang.String cookieValue,
java.lang.String path,
java.util.Date expires,
boolean secure,
java.lang.String domain)
Each HTTP request sends a set of headers to the server, which helps the server understand the kind of request. |
void |
addHeader(java.lang.String headerName,
java.lang.String headerValue,
java.lang.String testParameterName)
Each HTTP request sends a set of headers to the server, which helps the server understand the kind of request. |
void |
addMultiPartFileParameter(java.lang.String contentType,
java.lang.String parameterName,
java.lang.String fileName,
java.lang.String charSet,
java.lang.String contentTransferEncoding,
java.lang.String testParameterName)
A POST request can be sent into multiple parts to the server using MultiPart request. |
void |
addMultiPartParameter(java.lang.String parameterName,
java.lang.String parameterValue,
java.lang.String charSet,
java.lang.String contentTransferEncoding,
java.lang.String testParameterName)
A POST request could be sent into multiple parts to the server using MultiPart request. |
void |
addMultipartRequestEntity()
To add multipart request to Post method |
void |
addParameter(java.lang.String parameterName,
java.lang.String parameterValue,
java.lang.String testParameterName)
A task can have many request parameters. |
void |
addPostParameter(java.lang.String parameterName,
java.lang.String parameterValue,
java.lang.String testParameterName)
When a form is submitted, all the form attributes are submitted as Post
parameters. |
void |
addRequestEntity(java.lang.String requestEntity)
To add string request entity to Post method |
void |
addRequestEntityParameter(java.lang.String parameterName,
java.lang.String parameterValue,
java.lang.String testParameterName)
|
void |
addRequestEntityParameter(java.lang.String parameterName,
java.lang.String parameterValue,
java.lang.String contentType,
java.lang.String charset,
java.lang.String testParameterName)
To add request entity parameter to Post method |
void |
addThinkTime(float virtualUser,
int type,
int startValue,
int endValue,
int valueType)
Delay in seconds before the task is actually executed. |
java.lang.String |
getRequestHeader(java.lang.String headerName)
To get request header value for a header name |
java.util.Map |
getRequestHeaders()
To get list of request headers |
java.lang.String |
getResolvedParameterValue(java.lang.String parameterName,
boolean getParameter)
To get resolved value of parameter |
java.lang.String |
getResolvedPassThroughParameterValue(java.lang.String parameterName)
To get resolved value of pass-through parameter |
java.lang.String |
getResponseHeader(java.lang.String headerName)
To get response header value for a header name |
java.util.Map |
getResponseHeaders()
To get list of response headers |
java.lang.String |
getSessionParameterName()
This can be used to get name of session parameter. |
java.lang.String |
getSessionParameterValue()
This can be used to get value of session parameter. |
javax.swing.tree.TreeModel |
getXMLResponse()
To get TreeModel by parsing XML Response |
boolean |
isSessionParameterPresent()
This can be used to check if session parameter is present |
void |
saveSuccessfulTaskResponse(boolean saveResponse)
|
void |
setContentCharset(java.lang.String charset)
This is to set charset |
void |
setExpectedResponseCode(int expectedResponseCode)
When a task is executed, it is expected to have some response code. |
void |
setPath(java.lang.String uri)
This can be used to set path directly from script. |
void |
setPath(java.lang.String uri,
java.lang.String encodeChar)
This can be used to set path directly from script. |
void |
setQueryString(java.lang.String queryStr)
This can be used to set dynamic query string Can be used in cases /request? |
void |
setRecordedFileName(java.lang.String recordedFileName)
This is helpful for validation purpose to match the replayed response with the recorded one. |
void |
setResponseTime(long responseTimeInMillis)
This can be used to set value of session parameter. |
void |
setSessionParameter(java.lang.String name,
java.lang.String value)
This can be used to set name and value of session parameter. |
void |
setSessionParameterName(java.lang.String name)
This can be used to set name of session parameter. |
void |
setSessionParameterValue(java.lang.String value)
This can be used to set value of session parameter. |
void |
setUseAuthentication(boolean useAuthentication)
A task may require authentication credentials when sent to the server, this can be configured using this method. |
Methods inherited from interface com.appperfect.devcommon.script.web.IHTTPScript |
---|
assertBrokenLinks, assertFormCount, assertImage, assertImageCount, assertInDatabase, assertInputElementCount, assertLinkCount, assertNodeAttributeValue, assertNodeText, assertPage, assertPageSize, assertPageText, assertText, assertText, assertText, assertText, assertText, assertTodaysDate, assertTodaysDate, getResponse, getResponseCode, getResponseSize, getResponseTime, getValidationResult, getWebResponse, isValidationSuccessful, setValidationSuccessful |
Methods inherited from interface com.appperfect.devcommon.script.IScript |
---|
getReasonForFailure, isIgnored, isTaskSuccessful, isTaskTimedOut, setIgnored, setReasonForFailure, setTaskSuccessful, setTaskTimedout, setThinkTime, setTimeout |
Method Detail |
---|
void addAsSubTaskTo(int parentId)
parentId
- task id of the parent to which this subtask should be attachedvoid addByteArrayRequestEntity(byte[] requestEntity)
requestEntity
- byte array containing the byte array request entityorg.apache.commons.httpclient.Cookie addCookie(java.lang.String cookieName, java.lang.String cookieValue, java.lang.String path, boolean secure)
cookieName
- name of the cookiecookieValue
- value of the cookiepath
- path of the cookiesecure
- true
if the host is secure;
false
otherwise
org.apache.commons.httpclient.Cookie addCookie(java.lang.String cookieName, java.lang.String cookieValue, java.lang.String path, java.util.Date expires, boolean secure)
cookieName
- name of the cookiecookieValue
- value of the cookiepath
- path of the cookieexpires
- date on which cookie expiressecure
- true
if the host is secure;
false
otherwise
org.apache.commons.httpclient.Cookie addCookie(java.lang.String cookieName, java.lang.String cookieValue, java.lang.String path, java.util.Date expires, boolean secure, java.lang.String domain)
cookieName
- name of the cookiecookieValue
- value of the cookiepath
- path of the cookieexpires
- date on which cookie expiressecure
- true
if the host is secure;
false
otherwisedomain
- domain name for the cookie
void addHeader(java.lang.String headerName, java.lang.String headerValue, java.lang.String testParameterName)
headerName
- name of the headerheaderValue
- value of the headertestParameterName
- name of the TestParameter if the header value is parameterizedvoid addMultiPartFileParameter(java.lang.String contentType, java.lang.String parameterName, java.lang.String fileName, java.lang.String charSet, java.lang.String contentTransferEncoding, java.lang.String testParameterName)
POST
request can be sent into multiple parts to the server using MultiPart request.
Contents of a file can be sent to the server using this method.
contentType
- Content-Type of the fileparameterName
- name of the multipart request parameterfileName
- name of the file name whose bytes need to be sent to servercharSet
- value of the multipart request parameter char set possible values are "ISO-8859-1"contentTransferEncoding
- value of the multipart request parameter transfer encoding default value is "binary"testParameterName
- name of the TestParameter if the parameter value is parameterizedvoid addMultiPartParameter(java.lang.String parameterName, java.lang.String parameterValue, java.lang.String charSet, java.lang.String contentTransferEncoding, java.lang.String testParameterName)
POST
request could be sent into multiple parts to the server using MultiPart request.
Parameters added to such a request should be added using this method
parameterName
- name of the multipart request parameterparameterValue
- value of the multipart request parametercharSet
- value of the multipart request parameter char set possible values are "US-ASCII"contentTransferEncoding
- value of the multipart request parameter transfer encoding default value is "8bit"testParameterName
- name of the TestParameter if the parameter value is parameterizedvoid addMultipartRequestEntity()
void addParameter(java.lang.String parameterName, java.lang.String parameterValue, java.lang.String testParameterName)
GET
parameter needs to added using
this method. A parameter added with this method is appended to the URL when the task is executed
parameterName
- name of the request parameterparameterValue
- value of the request parametertestParameterName
- name of the TestParameter if the parameter value is parameterizedvoid addPostParameter(java.lang.String parameterName, java.lang.String parameterValue, java.lang.String testParameterName)
form
is submitted, all the form attributes are submitted as Post
parameters. A parameter added with this method is sent as a part of the body of the request.
parameterName
- name of the request parameterparameterValue
- value of the request parametertestParameterName
- name of the TestParameter if the parameter value is parameterizedvoid addRequestEntity(java.lang.String requestEntity)
requestEntity
- string containing the request entityvoid addRequestEntityParameter(java.lang.String parameterName, java.lang.String parameterValue, java.lang.String testParameterName)
parameterName
- parameterValue
- testParameterName
- void addRequestEntityParameter(java.lang.String parameterName, java.lang.String parameterValue, java.lang.String contentType, java.lang.String charset, java.lang.String testParameterName)
parameterName
- name of the request parameterparameterValue
- value of the request parametercontentType
- content typecharset
- byte character settestParameterName
- name of the TestParameter if the parameter value is parameterizedvoid addThinkTime(float virtualUser, int type, int startValue, int endValue, int valueType)
virtualUser
- % Virtual User who should use this think time settingtype
- Type of value whether its Fixed (0) value or Random Value (1)startValue
- Think time valueendValue
- End value of think time in case of random valuevalueType
- Whether value specified is in seconds (0) or in milliseconds (1)java.lang.String getRequestHeader(java.lang.String headerName)
headerName
-
java.util.Map getRequestHeaders()
java.lang.String getResolvedParameterValue(java.lang.String parameterName, boolean getParameter)
parameterName
- name of the task parametergetParameter
- true
if the parameter is of type Get that is to be passed in Query String
java.lang.String getResolvedPassThroughParameterValue(java.lang.String parameterName)
parameterName
-
java.lang.String getResponseHeader(java.lang.String headerName)
headerName
-
java.util.Map getResponseHeaders()
java.lang.String getSessionParameterName()
java.lang.String getSessionParameterValue()
javax.swing.tree.TreeModel getXMLResponse()
boolean isSessionParameterPresent()
void saveSuccessfulTaskResponse(boolean saveResponse)
saveResponse
- void setContentCharset(java.lang.String charset)
charset
- void setExpectedResponseCode(int expectedResponseCode)
expectedResponseCode
- expected response code after execution of this taskvoid setPath(java.lang.String uri)
uri
- void setPath(java.lang.String uri, java.lang.String encodeChar)
uri
- encodeChar
- void setQueryString(java.lang.String queryStr)
queryStr
- void setRecordedFileName(java.lang.String recordedFileName)
recordedFileName
- file path of the response when this task was recorded.void setResponseTime(long responseTimeInMillis)
responseTimeInMillis
- void setSessionParameter(java.lang.String name, java.lang.String value)
name
- value
- void setSessionParameterName(java.lang.String name)
name
- void setSessionParameterValue(java.lang.String value)
value
- void setUseAuthentication(boolean useAuthentication)
useAuthentication
- true
if this task should use authentication
details while it is sent to the server; false
otherwise
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |