Post Command

Description:

This command issues an HTTP/S POST request for a specified resource.
The "Check Contains" option allows to search the presence of a character string in the response of http request.

Remark: The "Add check on page title" record option adds automatically a "Check contains" on the http request in order to validate that the web page title is correct.

Format:

httpMode [ PRIMARY ] [POST | METHOD method_type] HOST hostname URL url
[ IDENTIFIER request_id ]
[ HEADERS {http_headers} ]
[ COOKIES {cookies} ]
[ RESPONSE_TIMER timer_name ]
[ RETRY retry_number ]
[ REFERER referer_id ]
[ URLENCODED_FORM httpForm | MULTIPART_FORM httpForm | BODY httpBody | FLEX httpFlex | JSON httpJson | GWT httpGwt ]
[ CHECK check_name CONTAINS checkContainsExpression ON_FAILED checkAction ]
[ CHECK check_name CONDITION checkExpression ON_FAILED checkAction ]
[ variable1 = expression1 ] [ variable2 = expression2 ] ...

Parameters:

httpMode

Possible values are:

HTTP  The request is sent in non-secured mode 
HTTPS The request is sent in secured mode (SSL)

PRIMARY

The optional PRIMARY keyword denotes primary HTTP requests such as those referred to by the "referrer" header in secondary requests. PRIMARY requests are most of the time the first HTTP/S requests sent after a user action in the browser.

METHOD

The optional METHOD keyword replace POST method by "method_type" (eg: "HEAD").

hostname

A string expression containing the URL host name field.

url

A character variable, quoted character string or character expression containing the URL path field.

request_id

An integer constant representing the request identifier (should not be modified).

http_headers

A string value list (comma separated list of character strings) containing http headers to add to this requests.
If a CONFIGURATION command precedes the request in the script, http headers included in the CONFIGURATION command will also be added to the request.

cookies

A string value list (comma separated list of character strings) containing additional cookies to be sent with this request.
Cookies which are sent by the server via "Set-Cookies" HTTP headers are not shown in the recorded script since they will be managed automatically by the HTTP injector during the replay.
The record engine adds the COOKIES option to a request if the request contains 'unknown' cookies (cookies which were not sent by the server during record session). These are usually cookies which were already stored by the client before the record has started.

timer_name

A timer name. The timer value will be the time to load this request.
Note that this option will pause the script execution until the response is loaded.

retry_number

An integer variable containing the number of times the request should be attemped again.
If this option is not set, the Retry_Count value specified in the TExecuter_web.ini file is used.

referer_id

An integer variable to identify which request must be specified in the 'Referer' header.
The request that has the same request_id as referer_id is used.

httpBody

A string expression containing the request body.
If the httpBody string has the form "binary(N)", an arbitrary buffer of N bytes is sent.
If the httpBody string begins with "0x", the following characters are interpreted as hexadecimal codes and corresponding bytes are sent (eg: if httpBody is "0x414243", "ABC" will be sent).

httpForm

A form variable containing the data to send using the "x-www-form-urlencoded/form-data protocol" or "multipart/form-data" protocol.

httpFlex

A string expression containing a XML tree convertion of an amf binary data. See details about Flex in AgileLoad.

httpJson

A string expression containing a XML tree convertion of a JSON data. See details about JSON in AgileLoad.

httpGwt

A string expression containing a XML tree convertion of a GWT data. See details about Gwt in AgileLoad.

check_name

A string expression containing a check name. This name appears in the audit log message if the check fails.

checkExpression

An integer expression. If the expression is evaluated to zero, the check fails, otherwise the check succeed.

checkContainsExpression

character string expression to search in the request response.

checkAction

The action to execute if the check failed, possible values are:

CONTINUE  The virtual user continue to execute the script.
EXIT_SCRIPT  The virtual user exit the current script.
STOP USER  The virtual user is stopped.
GOTO labelName  The virtual user jumps to the specified 'labelName' label.

variable1 = expression1
variable2 = expression2
...

You can attach some variable assignments to a request in order to extract some parts of the response and use them further in the script.

Example:


HTTP PRIMARY POST HOST "www.abc.com" URL "/default.htm" IDENTIFIER 1
    BODY "body content"
    CHECK "AgileLoad BookStore - Home" CONTAINS "AgileLoad BookStore - Home" ON_FAILED STOP USER

See Also:





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap