End-to-end demonstration of testing an orchestrated flow
Testing an orchestrated flow is very interesting in SoapUI and the tools help you a lot while also automating your end-to-end flow. Let's take an example of a service orchestration in a stock management application:
Example: The application has five APIs for maintaining stock
Get Stock Availability: Get the availability of the stock
Reserve Stock: Reserve the Stock if the stock is available
Commit Reservation: Finally commit a reservation based on the reservation ID received from the reserve stock response
Validate Reservation: Validate whether the reservation commit was successful or not
Cancel Reservation: Cancel a reservation
Scenario1: Canceling a reserved stock and verifying if the stock gets added in the available stock list or not.
Call1: Get stock Availability: This returns the availability of the stock with the number of quantities available
Validations on the call:
V1: Verify that the number of Quantities Returned are in sync in the database
V2: Verify that the quantities of stocks are adjusted automatically when a reservation is cancelled or when a stock is reserved
Following are the SoapUI screenshots for a more detailed look.
Get Stock Availability: We now will trigger this call for a specific product ID and location and see the status for a product and its availability:
So now we see in the preceding screenshot that that product is available and we have 385 quantities for this item.
Let's now go ahead and reserve it.
Reserve Stock: We will now reserve the same stock for which we did a get stock availability call.
Retriggering Get Stock Availability:
We can now see that the available quantity has decreased by 1, this then proves that the orchestration between Get Stock Availability and Reserve stock is working as expected.