In your end-to-end functional tests you can manage Web Services flows directly in your Agilitest/ATS automatic test scripts.
The objective is that you can control the exchanged data or even recover them to reuse them for functional purposes in your automatic tests.
Writing the Web Service call in Agilitest
To do this, simply enter the "Start channel" action with the full http link of your Web Service request:
Executing this "Start channel" action will automatically open a specific viewer that will allow you to capture all the data you want to check and/or retrieve in this Web Service stream.
Agilitest will automatically detect whether it is SOAP or REST (in which all other types of services that are not SOAP will also be included).
This capture window will communicate all the actions available in the submitted Web Service:
Writing the method addressed to this Web Service in Agilitest
The second specific Web Service action is found on the "Navigation" and REST or SOAP Webservice
The REST action is by default GET, but all the HTTP methods of the standard are available: Get, Post, Delete, Patch, and Put.
You can enrich the query either by the method (URL), or by the API parameters, or by the headers, or all in the same time.
You can manually switch to the SOAP type via the dedicated button:
For all Web Services you can according to your needs.
- Send requests directly via the method (i.e. the html link in which you have filled in the desired information).
- Use the "API Data" box to complete, complexify or clarify the query.
- Use the "Request header" box to manage the headers if necessary.
There are two additionnal parameters which you can use :
- Change port: Allows you to indicate on which port you want to query the webservice.
- Use the cache: When possible, Agilitest will not make a new request if the requested data is already in the cache.
If you don't know the body of available actions: the Wizdler plugin
If you don't know the body of the Web Service, here is a simple trick to help you analyze WSDL files and generate SOAP messages:
- Install the WIZDLER plugin on your web browser (Chrome for example: Link to the Plugin Wizdler here)
- Open your http Web Service link on the same browser
- Click on the dedicated Wizdler button:
4. Click on one of the actions available on this Web Service (e. g. CapitalCity) to retrieve the body and paste it into the "API Settings" box.
5. Do not forget to fill in the related action in the "method" of the Agilitest action
6. You can even test the action by replacing the default data[string] and then clicking on the dedicated "Go" button and checking the result returned by the Web Service
Capture of data returned by the Web Service
Now that the "method" and the "API Settings" box of your action are filled in, Agilitest will be able to automatically execute the action in your functional flow.
You can capture the query result via Agilitest's capture mode.
The "Property" action allows you to reuse the target data returned by the Web Service in your script:
The recovery of the attribute "value" in this case allows us to recover the Capital of the Country whose ISO code is FR, namely Paris.
The Check and Property recovery actions will very often be the most relevant actions in writing your end-to-end functional tests using Web Services.
Example of a SOAP script
Please find here an example of ats SOAP script: SOAP_flag_demo.ats
Right-click on the link above and select "Save link as…" to retrieve the ATS file.
You can add it to your Agilitest project to edit and/or run it.