We're here to help

Web services testing

Invoking the Connection

Once you have created the REST or SOAP Web Service Connection, you can now invoke it in a Test Case to perform Web Services testing.

To do this, locate the Web Connect API from the Web section of the API Palette, then click and drag it into the Test Case:

Select the relevant Web Service Connection in the Connection parameter:

Now you you can ready to make a SOAP or REST request. To perform a REST Request (including AWS operations for Provar 1.9.7 and later), move on to the next section. For a SOAP Request, skip ahead to Performing a SOAP Request.

 

Performing a REST request

To perform a REST request, locate the Web Request (HTTP/REST) API from the Web section of the API Palette, then click and drag it into the Test Case:

You will be asked for the Resource URL, Request Header and Method:

  • Resource URL: URL of the object or set of objects that are exposed at the API endpoint
  • Request Header: Optional parameter for HTTP headers, allowing the client and the server to pass additional information with the request or the response
  • Method: Methods for mapping CRUD (create, retrieve, update, delete) operations to HTTP requests

The methods are as follows:

HTTP Method CRUD
GET Read
POST Create
PUT Update/Replace
PATCH Partial Update/Modify
DELETE Delete

If the Method is POST, PUT or PATCH, you will also be asked for the Body Style and Body.

  • Body Style: In this we specify the format of body that needs to be send. Body style can be ‘JSON’, ‘Multipart’ or ‘Other’.
  • Body: The term ‘Body’ is used to distinguish between the ‘interesting’ information in a chunk of data. Basically Body is the data that we need to be sent to create or update something.

Here is a POST example:

Here is a PATCH example:

Once the Test Case is run, it will appear as follows in the Test Runner:

The RestResponse and RestResponse status will also be shown under Variables(after) in the Variables view:

AWS operations

For an AWS Authentication REST Connection, we can then use REST Requests to perform operations on AWS. We can create a bucket using a PUT method, setting Resource URL to the bucket name and entering content in the Body with location configurations.

For example:

After executing the above create bucket API through Provar, we can see the bucket created in AWS.

We can also delete a bucket using a DELETE method, for example:

We can also upload objects in a bucket through Provar and perform actions on them.

For this, the Resource URL should have the format ‘/bucketname/filename’, the Body parameter should have the file content, and Content Type should specify the format of the file.

After successful execution, the results can be viewed in AWS:

And in Provar Desktop:

For AWS APIs with a custom lambda integration, we just need to pass the stage URL (the basic URL to perform rest request) and other parameters, for example:

Performing a SOAP request

To Perform a SOAP request, locate the Web Service Request (SOAP) API from the Web section of the API Palette, then click and drag it into the Test Case:

You will then be asked for the WSDL Location Override. This is an optional parameter where you can define a different WSDL from the one set at the SOAP Connection level. (If it is the same, leave it blank.)

You will then be asked for the Service, Port, Operation and Body Contents which will populate once the WSDL is loaded.

  • Service : A service is well-defined, self-contained function that represents unit of functionality. A service can exchange information from another service. It is not dependent on the state of another service.
  • Port: The WSDL portType element defines a group of operations, also known as an interface in most environments. Each operation element contains a combination of input and output elements, and when you have an output element you can also have a fault element.
  • Operation: An operation is a particular action performed by a service, such as any of the “get scores”, “get schedules”, and “get standings” examples for the World Cup service.
  • Body Content:  Body Content contains the data that is needed to be sent to process a request.

For Body Contents, click the magic wand icon to ‘Generate a sample body for this Web Service request’:

For example:

Once the Test Case is run, it will appear as follows in the Test Runner:

The WebResponse and SoapResponseStatus will also be shown under Variables(After) in the Variables view.