TAST tool Menu
TAST Adaptors
Adaptors examples
TAST Integrations
Interesting features
Documentation of technical administration
Modeling recommendations
Training in the TAST tool
TAST tool Menu
TAST Adaptors
Adaptors examples
TAST Integrations
Interesting features
Documentation of technical administration
Modeling recommendations
Training in the TAST tool
This adapter is used to run tests of Web Services: REST, SOAP and others.
In the adapter setup we must include all the data that we consider descriptive of the service in general and that apply to all your requests. So that the user does not have to pass them in each message of the diagram. As for example the base url of the service, headers or the authentication method.
It would be the part of the URL that is common to all the requests or requests about that web service, so that the user does not have to enter it in each message that he configures as a request service.
It is understood that the first interaction that the adapter must perform with the web service will be the authentication and authorization. Currently there are several different standard methods to perform this step and other owners that I would leave to develop on demand, that is, if we find the need.
To emphasize that they are not authentication-authorization methods of the Web Rest services, rather they are associated with the Http protocol, so the development should be oriented to be reused by the Html GUI adapter and the Webservices SOAP adapter, if in the future intends to access any Web application that uses any of these methods to authenticate-authorize itself.
To administer the authentication_type field exists a combo field, which contains a defined authentication that must be enumerated to the user for selection.
Now comes the enumeration of the authentication types, make a brief description of them and think what parameters we might need.
Below is the list of Predefined Functions for sending requests to the server provided by the adapter, and parameters necessary for its execution. In rest the types of requests correspond with the different methods / verbs contemplated in the HTTP protocol. In principle there will be a function to form a request for each HTTP method. Another requirement is that variables in the diagram should be allowed to compose the different fields of the request.
The existing methods are:
As you know, Http is a stateless request / response protocol, but sometimes workflows force several requests to be related as if they were from the same client. That is, keep the session between client and server throughout the workflow. It is usually done with cookies, although it can also be done through headers.
In any case, this is transparent for the user, but the adapter must take this into account, since it must store the cookie sent by the server in the first request to add it to the subsequent Http requests in the diagram. Or in other cases through Tokens that are provided by the server after authenticating and that the client must include in a header in each request.
It is possible that the user must tell us whether to keep a session during the sending of several consecutive messages, and the mechanism that the server uses to do so. In SoapUi, when creating a test case, it offers us the possibility of marking a chek-box that indicates if we want to keep the session, just ask for no more data, I understand that you try to keep it transparent to the user.
Data recovery Functions of the Response.
The above functions are aimed at validating the response obtained by the request, but we have not yet provided the user with functions that allow him to retrieve the information contained in the response.
As we have indicated previously some of these functions could be:
As you know, Http is a stateless request / response protocol, but sometimes workflows force several requests to be related as if they were from the same client. That is, keep the session between client and server throughout the workflow. It is usually done with cookies, although it can also be done through headers.
In any case, this is transparent for the user, but the adapter must take this into account, since it must store the cookie sent by the server in the first request to add it to the subsequent Http requests in the diagram. Or in other cases through Tokens that are provided by the server after authenticating and that the client must include in a header in each request.
It is possible that the user must tell us whether to keep a session during the sending of several consecutive messages, and the mechanism that the server uses to do so. In SoapUi, when creating a test case, it offers us the possibility of marking a chek-box that indicates if we want to keep the session, just ask for no more data, I understand that you try to keep it transparent to the user.
The REST mapping assistant allows, from a diagram already stored, to modify those direct messages whose destination is an object mapped with the WebService adaptor.
Those messages that have mapped a predefined function can be executed as they would be executed when a test is launched. The execution generates data that will be presented to the user.
It is also possible to edit and execute assertions that have previously been associated with messages.
For the REST mapping assistant to work perfectly it is necessary to include a prerequisite in the browser configuration. It is necessary to allow the opening of pop-ups under the URL of the application.
In Internet Explorer 11:
The REST Mapping Assistant opens from the Modeling / UML Diagram view. To open it, it is necessary to click on the “magic wand icon” of the toolbar of the diagram, and select the option REST / TAST API.
This assistant will only be opened if the diagram has at least one object, whose adaptor is the WebService Adaptor. Otherwise, the user will be informed.
The assistant will be opened in a pop-up window. Before being launched, the diagram will be saved, and later, the edition will be blocked. Example:
Once the assistant is closed (pop-up window), the mapping data of the diagram will be updated and unlocked, so that it can continue to be edited.
From this view is possible to select the object with which we want to work. Only objects mapped with the WebService adaptor can be selected.
Once an object has been selected, the mapped values for that object will be displayed. These values can be edited.
From the message view you can select one of the direct messages that arrive at the object that we have previously selected.
The mapped values for that message are shown, as long as the message has been mapped with a predefined function. Otherwise, all input fields will appear empty.
The sub-section Assertion, will show the data of the assertion associated with the selected message, if it exists. Otherwise, the input fields for the assertion will be disabled.
Runs the selected message. It presents the user with the results of the execution. Example:
The message named getRest has been executed. You can see the input parameters associated with that message.
The result of the execution is shown in the Result subsection.
The Headers and Body tabs present the data received after executing the request.
Below is the status of the request, the response time and the size it occupies.
Runs the assertion associated with the selected message.
The result of the assertion is presented in the tab “Output parameters”.
By the moment, there are no specific assertions defined for REST messages. It is therefore necessary that said assertion functions have at least two parameters: the first will be the value of the stepResult, and the second will contain the value of the result of the execution of the request.
For the other parameters of the function, it is possible to give a value from the tab “Input variables” of the sub-section Assertion.
Allows to save the edited data.
Messages can have three types of predefined functions associated:
Allow the sending of REST requests of type: GET, POST, PUT and DELETE.
In this section, each of the input fields of each type of REST request will be enabled:
By clicking on each text field, the tab corresponding to that parameter will open, where its values can be filled. Example:
Clicking on WS Parameters, we can edit these values:
If we click on the button we will send the REST request that we are visualizing.
In the Result section, we can see the data received after executing the request:
Allow to change the authentication used during the REST requests.
Clicking on this text box the Auth tab will open, where you can edit the values of the authentication parameters.
The authentication parameters depend on the type of authentication represented by the selected predefined function. Example:
List of parameters for BasicAuth authentication:
If we click on the button we will send the authentication that we are visualizing, and that will be the one used by the rest of the REST requests.
The authentication to be used for each REST request made can be displayed in the “Authorization set by” field, existing in Message.
When sending an authentication message, this field will be updated, indicating the name of the message responsible for modifying the authentication of future REST requests. Example:
After executing an authentication message, we can see the authentication that will be used for future REST requests:
NOTE: In case that the authentication is provided by the adaptor parameters, it will also be shown by the “Authorization set by” field:
Allow to obtain a value or property, from the response of a REST request sent previously.
Clicking on this text box, the Value tab will open, where you can edit the values of the values query parameters.
The values query parameters depend on the type of query that is made. Example:
Parameters for the getJSONElementValueByJsonPath query:
If we click on the button we will send the query, determined by the predefined function selected in the “Request” selector, and the answer on which the query is made, field “Response name”.
The application will present the result of the query in the Value tab, existing in Message / Result.
When responding in XML / JSON format, the Xpath or JSONPath can be obtained from the elements of the received response itself, respectively.
From the Body tab, existing in Message / Result, and once a response has been received:
It will be selected, XML or JSON, depending on the type of Path to calculate. The button will be clicked.
In case the answer can not be parsed with the chosen format, a message will be displayed warning of this situation.
In case the answer is correctly parsed, it will be presented in a text box, where you can click on the elements of the answer for which the JSONPath / XPath can be calculated.
The elements on which your JSONPath / Xpath can be obtained, will present a hand when the cursor passes over them.
By clicking on them, the JSONPath / XPath will be presented on the text box immediately below:
The calculated JSONPath / XPath value can be copied to the clipboard by clicking on the button