Nowadays many applications, such as payment apps, use WebServices to send and receive messages. These messages can be paying a receipt, payment confirmation or changing the status of a service, among others.
In the testing environment we have a variety of combinations of functional tests for each type of service, like test error of different error messages or warnings to monitor implementation. However, these tests can be very tedious for the large number of cases that may arise.
For the cases involving WebServices, where sendings are XML and SOAP messages with a defined structure, the automation is easier, generating savings of time and resources in the executions of test cases.
SOAP or XML structures are defined by labels that indicate the variable that is being sent in a specific Request or Response.
In order to automate, the first thing we must do is to parameterize the variables used by each service, that is, identifying each of the variables and relate them to the data we use for our tests.
Then, using the chosen tool for sending and receiving messages (SOAPUI or UFT for instance) proceed to run tests. UFT is perfect to automate these cases integrating our Testdata inside the tool and using checkpoints to control the response. In the tool we have to choose API configuration and “SOAP Request” canvas.
Below, a simple example of the case:
In this case the variable to be parameterized is within the “StockName” tag, which can have different values within our DataTest:
- Computer HP
- IBM Computer
- Computer “X”
We parameterize the response we expect in our dataset, to the evidence:
If the values we expected and the values system gives us back are the same, our test will be valid, otherwise we will give as failed and we will open a default. In the same way we can prove error cases and wait the respective error message.
Written by Julio Jesús de Lama