com.appperfect.loadtester.script
Interface HTTPScript

All Superinterfaces:
IHTTPScript, IScript

public interface HTTPScript
extends IHTTPScript

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.

See Also:
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

addAsSubTaskTo

void addAsSubTaskTo(int parentId)
To add Sub Task to the parent task

Parameters:
parentId - task id of the parent to which this subtask should be attached

addByteArrayRequestEntity

void addByteArrayRequestEntity(byte[] requestEntity)
To add binary request entity to Post method

Parameters:
requestEntity - byte array containing the byte array request entity

addCookie

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. This method is used to add a header to the request

Parameters:
cookieName - name of the cookie
cookieValue - value of the cookie
path - path of the cookie
secure - true if the host is secure; false otherwise
Returns:
new cookie created and add to http request object. This is done so that if user wants to set other properties of cookie he can do that.

addCookie

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. This method is used to add a header to the request

Parameters:
cookieName - name of the cookie
cookieValue - value of the cookie
path - path of the cookie
expires - date on which cookie expires
secure - true if the host is secure; false otherwise
Returns:
new cookie created and add to http request object. This is done so that if user wants to set other properties of cookie he can do that.

addCookie

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. This method is used to add a header to the request

Parameters:
cookieName - name of the cookie
cookieValue - value of the cookie
path - path of the cookie
expires - date on which cookie expires
secure - true if the host is secure; false otherwise
domain - domain name for the cookie
Returns:
new cookie created and add to http request object. This is done so that if user wants to set other properties of cookie he can do that.

addHeader

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. This method is used to add a header to the request

Parameters:
headerName - name of the header
headerValue - value of the header
testParameterName - name of the TestParameter if the header value is parameterized

addMultiPartFileParameter

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. Contents of a file can be sent to the server using this method.

Parameters:
contentType - Content-Type of the file
parameterName - name of the multipart request parameter
fileName - name of the file name whose bytes need to be sent to server
charSet - 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 parameterized

addMultiPartParameter

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. Parameters added to such a request should be added using this method

Parameters:
parameterName - name of the multipart request parameter
parameterValue - value of the multipart request parameter
charSet - 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 parameterized

addMultipartRequestEntity

void addMultipartRequestEntity()
To add multipart request to Post method


addParameter

void addParameter(java.lang.String parameterName,
                  java.lang.String parameterValue,
                  java.lang.String testParameterName)
A task can have many request parameters. Each GET parameter needs to added using this method. A parameter added with this method is appended to the URL when the task is executed

Parameters:
parameterName - name of the request parameter
parameterValue - value of the request parameter
testParameterName - name of the TestParameter if the parameter value is parameterized

addPostParameter

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. A parameter added with this method is sent as a part of the body of the request.

Parameters:
parameterName - name of the request parameter
parameterValue - value of the request parameter
testParameterName - name of the TestParameter if the parameter value is parameterized

addRequestEntity

void addRequestEntity(java.lang.String requestEntity)
To add string request entity to Post method

Parameters:
requestEntity - string containing the request entity

addRequestEntityParameter

void addRequestEntityParameter(java.lang.String parameterName,
                               java.lang.String parameterValue,
                               java.lang.String testParameterName)
Parameters:
parameterName -
parameterValue -
testParameterName -

addRequestEntityParameter

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

Parameters:
parameterName - name of the request parameter
parameterValue - value of the request parameter
contentType - content type
charset - byte character set
testParameterName - name of the TestParameter if the parameter value is parameterized

addThinkTime

void addThinkTime(float virtualUser,
                  int type,
                  int startValue,
                  int endValue,
                  int valueType)
Delay in seconds before the task is actually executed.

Parameters:
virtualUser - % Virtual User who should use this think time setting
type - Type of value whether its Fixed (0) value or Random Value (1)
startValue - Think time value
endValue - End value of think time in case of random value
valueType - Whether value specified is in seconds (0) or in milliseconds (1)

getRequestHeader

java.lang.String getRequestHeader(java.lang.String headerName)
To get request header value for a header name

Parameters:
headerName -
Returns:
to get value of request header

getRequestHeaders

java.util.Map getRequestHeaders()
To get list of request headers

Returns:
to get list of request headers

getResolvedParameterValue

java.lang.String getResolvedParameterValue(java.lang.String parameterName,
                                           boolean getParameter)
To get resolved value of parameter

Parameters:
parameterName - name of the task parameter
getParameter - true if the parameter is of type Get that is to be passed in Query String
Returns:
resolved value which will be used during execution

getResolvedPassThroughParameterValue

java.lang.String getResolvedPassThroughParameterValue(java.lang.String parameterName)
To get resolved value of pass-through parameter

Parameters:
parameterName -
Returns:
to get resolved passthrough parameter value

getResponseHeader

java.lang.String getResponseHeader(java.lang.String headerName)
To get response header value for a header name

Parameters:
headerName -
Returns:
to get value of response header

getResponseHeaders

java.util.Map getResponseHeaders()
To get list of response headers

Returns:
to get list of response headers

getSessionParameterName

java.lang.String getSessionParameterName()
This can be used to get name of session parameter.

Returns:
returns session parameter name

getSessionParameterValue

java.lang.String getSessionParameterValue()
This can be used to get value of session parameter.

Returns:
to get value of session parameter

getXMLResponse

javax.swing.tree.TreeModel getXMLResponse()
To get TreeModel by parsing XML Response

Returns:
to create and return tree model of a XML response

isSessionParameterPresent

boolean isSessionParameterPresent()
This can be used to check if session parameter is present

Returns:
to check if session parameter is present

saveSuccessfulTaskResponse

void saveSuccessfulTaskResponse(boolean saveResponse)
Parameters:
saveResponse -

setContentCharset

void setContentCharset(java.lang.String charset)
This is to set charset

Parameters:
charset -

setExpectedResponseCode

void setExpectedResponseCode(int expectedResponseCode)
When a task is executed, it is expected to have some response code. This is typically the recorded response code.

Parameters:
expectedResponseCode - expected response code after execution of this task

setPath

void setPath(java.lang.String uri)
This can be used to set path directly from script.

Parameters:
uri -

setPath

void setPath(java.lang.String uri,
             java.lang.String encodeChar)
This can be used to set path directly from script.

Parameters:
uri -
encodeChar -

setQueryString

void setQueryString(java.lang.String queryStr)
This can be used to set dynamic query string Can be used in cases /request?Value&Param1=Value1 since there is no parameter name associated with Value we will need this API to pass Value.

Parameters:
queryStr -

setRecordedFileName

void setRecordedFileName(java.lang.String recordedFileName)
This is helpful for validation purpose to match the replayed response with the recorded one.

Parameters:
recordedFileName - file path of the response when this task was recorded.

setResponseTime

void setResponseTime(long responseTimeInMillis)
This can be used to set value of session parameter.

Parameters:
responseTimeInMillis -

setSessionParameter

void setSessionParameter(java.lang.String name,
                         java.lang.String value)
This can be used to set name and value of session parameter.

Parameters:
name -
value -

setSessionParameterName

void setSessionParameterName(java.lang.String name)
This can be used to set name of session parameter.

Parameters:
name -

setSessionParameterValue

void setSessionParameterValue(java.lang.String value)
This can be used to set value of session parameter.

Parameters:
value -

setUseAuthentication

void setUseAuthentication(boolean useAuthentication)
A task may require authentication credentials when sent to the server, this can be configured using this method.

Parameters:
useAuthentication - true if this task should use authentication details while it is sent to the server; false otherwise


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.