The Send Request operation sends an HTTP request to a specified URL using a specified HTTP request method.
The operation returns the response from a web server. You can use the response later in your test. For example, you can save it to a file by using the Save to File operation.
Add the Save to File operation after the Send Request operation.
Specify the path to which you want to save the file and the required encoding.
Click the ellipsis button next to the Content field.
In the Edit Value dialog, select the Last Operation Result mode.
The server response will be saved to the specified file.
If TestComplete sends the request successfully, and the server returns an OK response, the operation will post information about the request and the response body and header to the test log.
Otherwise, the operation will post an error message to the test log.
|Tip:||If a request fails due to the status code error, the information about it will also be posted to the test log.|
The operation is an analogue of the
The operation parameters are organized into the following pages:
Specify Request and Response Check Parameters
On this page, you can specify request parameters.
Required. The request method (an HTTP verb) to use.
The following operations are supported:
Required. String. An absolute URL path to the server or resource to which you want to send the request. Must include the protocol.
For example, https://smartbear.com or https://support.smartbear.com.
If the parameter does not include the protocol (for example, www.support.smartbear.com), the operation will fail.
String. If the target web server uses the Basic authentication, specify the login of the user on whose behalf you want to send the request.
String. If the target web server uses the Basic authentication, specify the password of the user on whose behalf you want to send the request.
Response status code check
Specifies how the operation will check the response status code:
Do not perform – The operation will not check the response status code.
Check for success – The operation will check whether the response status code means that the request has been sent successfully (that is, the status code is from 200 to 206).
Check for equality – The operation will check whether the response status code equals the specified value.
Specify Request Content
On this page, you can specify the headers and body content for your request.
Body – To specify the body content, either enter it in the edit box, or click Edit and define it in the resulting Edit Value dialog.
Headers – In that table, you can add headers to your request.
Click Add to add a new header and enter its name and value in the Name and Value columns.
Click Remove to delete the header. Click Clear to remove all the headers.
On the Operation Parameters page, you can review the parameters you have created and change them if needed.
To change the operation parameter’s value:
Specify a new value in the Value column.
– or –
Click the ellipsis button in the corresponding cell of the Value column and edit the value in the subsequent dialog. For detailed information about possible values, see Specifying Operation Parameters.
Once ready, click Finish to apply the changes you have made and create a new keyword test item.