Applies to ReadyAPI 2.5, last modified on October 5, 2018

About HTTP Request test step

An HTTP Request test step is a standalone HTTP request that can be used to call any HTTP service. This means you can use it to send an HTTP request through HTTP, HTTPS or JMS.

Using the test step’s properties, you can specify the request type (GET, POST or other), target URL, parameters, attachments and other values. You can also define specific assertions for checking the server response.

Creating HTTP Request test step

To create an HTTP request, you do not need to have a service added to your project. When you add the test step, you will see the New HTTP Request Step dialog:

New HTTP Request Step dialog
  • TestStep name – Specifies the name of a new test step.

  • Endpoint – Specifies the endpoint, to which the request will be sent.

  • Extract Params – Allows you to obtain parameters and their values from the URL specified in the Endpoint field.

  • Parameters – The list of request parameters. To modify them, use the toolbar buttons:

    • Add Parameter or Add Parameter– adds a new parameter.

    • Delete Parameter or Delete Parameter– removes the selected parameter.

    • Extract Params– extracts parameters from an endpoint specified in the ensuing dialog.

    • Move parameter down and Move parameter up– Move the selected parameter down and up correspondingly.

    For each parameter, you can modify its Name, Value and Type (Query, Template and so on). To learn more, see REST Parameter Types.

  • Method – specifies the type of the request (GET, POST, PUT, and so on).

Editing HTTP Request test step

You can modify test step settings in its editor:

HTTP Request test step overview

Click the image to enlarge it.

Here is a brief description of available panels in the request editor:

Name Description
Request Displays a table of request parameters.
You can use the project, test suite or other properties to specify parameter values. See the Modify Request Parameters example.
Raw Displays the header and body of the request in a text format.
ReadyAPI fills in this tab after you run the test step.
Outline Works for the requests that pass data in the XML format. The tab displays the request body content as a tree. You can change elements’ and attributes’ values in-place. Just double-click the cell with the needed value.
Auth On this panel, you select the (Basic, NTLM or SPNEGO/Kerberos) authorization type for your request. You can also specify authorization parameters here.
Headers On this panel, create and modify custom header fields.
Attachments On this panel, you specify the files to be attached to the request.
XSD Displays the document schema (if available).
Table Displays the contents of the node selected in the Outline panel, and the contents of its sibling nodes, if any. If needed, you can modify data directly in the table cells.
This panel is shown only if the request body contains XML data.
XML Displays the XML code of the node that you selected in the Outline panel.
JMS Headers Displays the Java Message Service headers and properties. This panel is available if you specified a JMS endpoint for the request.

Once you run the test step, the server response is available in the response editor.

Property list

Besides editors and inspectors, you can adjust the test step’s behavior by using its properties in the HTTP Request Properties and Custom Properties tabs.

Name Description
Name

The test step’s name.

Description

Text describing the test step.

Encoding

UTF-8 or iso-8859-1. Specifies the encoding of the request data in the request header.

Endpoint

The target URL (same as the Request URL in the test step editor). Do not forget to specify the port number, if your web service uses it.

Timeout

Specifies the number of milliseconds to wait for the server response. If no data arrives within the specified time period, the test step is considered to be failed. If the property value is 0 or is not specified, the wait time is infinite.

Bind Address

Specifies the network interface (IP address), through which ReadyAPI will send the request. You may need to use this property if your computer has several network interfaces (several network cards).

Follow Redirects

Specifies how ReadyAPI handles redirects. If the property is true and a redirect occurs, the test step will ignore the redirect and will consider the server response as if it was the response from the requested URL. If the property is false, ReadyAPI does not ignore the redirect response codes and handles the server response as it is. You may want to set this property to false to check whether the tested server redirects requests correctly.

Follow 302 Redirect with GET

If set to true, when a server redirects the request with the 302 status code, ReadyAPI sends the GET method.

Works only when the Follow Redirects property is set to true.
Username

The user name used for authorization (if the request requires authorization). You can also change this property on the Auth page of the test step editor.

Password

The password used for authorization (if the request requires authorization). You can also change this property on the Auth page of the test step editor.

Domain

The domain name used for authorization (if the request requires authorization). You can also change this property on the Auth page of the test step editor.

Authentication Type

Specifies the authorization type to be used for the connection. This property is read-only in the Properties panel. To change it, switch to the Auth tab in the test step editor, and choose the desired authorization type and credentials there.

SSL Keystore

Specifies the file storing private keys that are used for sending the request. Works for HTTPS requests only.

Strip whitespaces

Works for request contents in the XML format. Specifies whether ReadyAPI removes comments and unneeded whitespaces from elements and attributes (required by some servers).

Remove Empty Content

Works for request contents in the XML format. Specifies whether ReadyAPI removes empty elements from the request. You may find this property useful for data-driven tests: in some cases, you may have no data, so it is preferable not to include them into a request at all rather than to send an empty element).

Entitize Properties

If true, ReadyAPI will escape special characters like > or & in the request body. You can set this property to false if the data is already escaped.

Multi-Value Delimiter

A URL can include several parameters having the same name. This property specifies the delimiter that will be used for the values in the editor. See below.

Pretty Print

true or false. Specifies whether ReadyAPI uses line feeds and indentation to display XML data of the response.

Dump File

The fully qualified name of the file, to which the test step will save the server's response. If the property is empty, the test step will not save the response to a file.

Max Size

The maximum number of leading bytes of the response that will be saved in the memory and visible in the editor. 0 (default) indicates that ReadyAPI will save the entire response.

You can use this property to save to the memory, if the response is large. If you need the entire response, you can save it to a file specified by the Dump File property.

If Max Size is not 0, assertions that you create in the test step will not work as there may be no data to verify. To check the server response in this case, use the Assertion test step.
Discard Response

Specifies whether the test step saves the response data (false) to the memory or file, or not (true). By default, the property is false. Set it to true to save to the memory when the response data is large. If the property is true, ReadyAPI will receive the response, run assertions and then remove the response data.

Send Empty Parameters

Specifies whether ReadyAPI will send empty values in the URL parameters of the request.

Values on the Custom Properties tab are available to other test steps in your project. For instance, you can verify these property values with the Assertion test step, or check them and change the execution flow with the Conditional GoTo test step.

You can load values of custom properties from a file, or save them to a file. To learn more, see About Properties.

This tab contains:

  • Properties that correspond to the request’s URL and body parameters.

  • Properties that provide access to the request and response data.

Name Description
Response

The response data without headers. You can see the same content in the response XML panel. To get response data without headers, use the RawResponse property.

RawRequest

The body content of the sent request. You can see the same content in the request Raw panel. Property expansions are converted to the expected values. To get data with unconverted property expansions, use the Request property.

Endpoint

Duplicates the Endpoint property of the HTTP Request Property tab. Used to get its value by using property expansion.

Username

Duplicates the Username property of the HTTP Request Property tab. Used to get its value by using the property expansion.

Request

The request body without headers. Property expansions are represented as they are without conversion to expected values. To get the sent request with converted property expansions, use the RawRequest property.

HarResponse

The response in the .har format.

Domain

Duplicates the Domain property of the HTTP Request Property tab. Used to get its value by using the property expansion.

ResponseAsXml

The response data as an XML DOM document (if possible).

Password

Duplicates the Password property of the SOAP Request Property tab. Used to get its value by using property expansion.

RawResponse

The response data with headers. You can see the same content in the Raw panel of the response editor. To get response data without headers, use the Response property.

Test step toolbar

The test step toolbar contains commands that allow you to modify a test step or appearance of the test step editor.

HTTP Request test step toolbar

Click the image to enlarge it.

Here is a brief description of some commands:

  • Method – Specifies the request type. ReadyAPI supports all the standard HTTP request types: GET (default), POST, PUT, DELETE and others. For more information on available types, see Method Definitions in the HTTP specification.

  • URL – Specifies the URL, to which the test step will send the request. You can enter the URL with parameters here. For more information on specifying parameters, see below. If needed, specify the port number.

  • Download Resources – This property has effect only for HTTP requests that return web pages. Web pages typically refer to additional resources like files and images. The property specifies whether the request will return these resources as attachments. You can see these resources in the response Attachments section.

Verifying response

To add, change or modify the assertions, use the Assertion panel. You can use the following assertions:

Name Description
Property Content:
Contains Verifies that the response contains the specified string.
Equals Verifies that the value of a property is equal to the specified value.
Equals (Binary) Checks whether the binary response is equal to a file.
Message Content Assertion Verifies that the message contains expected contents.
Not Contains Verifies that the response does not contain the specified value.
XPath Match Checks whether the result of the specified XPath expression is equal to the specified value.
XQuery Match Verifies that the result of the specified XQuery expression is equal to the specified value.
Compliance, Status and Standards
HTTP Download all resources Checks whether all resources are available and downloadable.
HTTP Header Equals Verifies that the response contains the expected value of an HTTP header.
HTTP Header Exists Verifies that the response contains the specified HTTP header.
Invalid HTTP Status Codes Checks whether the HTTP status code is not on the specified list.
JSON Schema Compliance Verifies that a request and response are compliant with the specified JSON schema.
Swagger Compliance Assertion Verifies that a request and response are compliant with an OpenAPI or Swagger definition.
Valid HTTP Status Codes Checks whether the HTTP status code is in the specified list.
Script
Script Assertion Executes a script to perform a custom assertion.
SLA
Response SLA Checks whether the response was returned within the specified timeout.
Security
Sensitive Information Exposure Checks whether the response does not contain any valuable information.

Logging

While the test step editor is open, brief information on sent requests is listed in the Request Log tab. If the test step is run as part of a test case, you can see a more detailed log in the Transaction Log panel.

Working with

Below, you can find information on common tasks that you can perform with the HTTP Request test step.

Specify a new endpoint in the test step toolbar.

To change the method of the HTTP request, use the method drop-down list on the test step toolbar.

You can modify request parameters on the Request panel. Toolbar buttons allow you to add, remove parameters, extract parameters from the specified URL, and change their order.

You can specify URL parameters for the request. You specify the URL when creating the test step. ReadyAPI automatically extracts parameter values from this URL string and displays them on the Request tabbed page. Use the page's toolbar to add more and delete the existing parameters, and to change their order.

If you need to specify multiple values for the same parameter, do this in the following way:

"Setting Multi-Value Parameter"

Do not forget to specify the delimiter character in the Multi-Value Delimiter property in the Properties panel.

To load the content of any parameter from a file:

  • Add the file to the Attachments panel in the request editor.

  • Get the data by using the property expansion with the following syntax:file:myFileName.log:

    REST service testing: Loading parameter values from a file

To specify values in text boxes and cells in the test step editor, you can use the project, test suite, and other property types. To refer to a property, use the following syntax:

  • ${#Project#MyPropertyName} – Project properties.

  • ${#TestSuite#MyPropertyName} – Test suite properties.

  • ${#Env#MyPropertyName} – Environment properties.

For more information, see Property Expansion.

To add a custom header:

  1. Open the Headers panel of the request editor.

  2. Click and specify the desired header and its value.

To remove the Content-Length: 0 header from your request, add the -Dsoapui.send.zero.content.length=false parameter to the vmoptions file located in the <ReadyAPI>/bin directory and restart ReadyAPI.

To add authorization:

  1. Open the Auth panel of the request editor.

  2. Select the desired Authorization profile.

To learn more about authorization, see Authorization.

To verify that the server returns the expected response, use assertions:

  1. Click Add Assertion on the request editor toolbar.

  2. In the Add Assertion dialog, specify the desired assertion.

  3. Set up a new assertion according to your needs and click OK.

Web pages typically refer to additional resources like scripts, images, css-files and other resources. To make sure the request retrieves all required resources, enable the Download Resources option.

Download Resources option

Click the image to enlarge it.

This property has effect only for HTTP requests that return HTML web pages.

The resources referenced by the page will be returned as attachments.

The Response will display the downloaded page. You can view the downloaded resources in the Attachments panel:

Attachments panel

Click the image to enlarge it.

To verify that all the resources are downloaded, use the HTTP Download Resources assertion.

You need to enable the Download Resources option. Otherwise, the assertion fails.
Download All Resources assertion

See Also

REST Request Test Step
Test Steps

Highlight search results