With regression testing of services using persistent state there are some particularities to consider as services using persistent state objects are working asynchronous.

In PurchaseOrderExample, that was used to build up a test scenario in Building up a Test Scenario, you've had no problems executing the test. But testing a real persistent state service you may get the problem, that a transition triggered by a service call has not yet finished, when triggering the next transition or when wanting to operate on the persistent state objects. In PurchaseOrderExample e.g. it could happen that adding the last item may not have been finished, when wanting to get all purchase orders.

To avoid such conflicts in PurchaseOrderExample, the SOAP operation getAllPurchaseOrders has to know whether all items have been appended yet. This can be achieved by changing the purchaseOrder model and adding conversation signals.

  1. The operation addNewItem has to be extended to sending a signal when the last item has been appended. This can be achieved by a flag lastItem that can be used to control whether a signal "Last Item Appended" should be sent.

    It is important to send this conversation signal not until the transition has finished: at the end of the behavior activity of the transition.

  2. A new SOAP operation has to be added: waitForLastItem. This operation will be used for regression testing only and will do nothing but wait for the last item. This will be indicated by the signal sent in step 1. In the Regression Test Tool, a test on this operation has to be executed after having sent all "Add Item" signals and before getting all purchase orders.

For more information on how to send conversation signals refer to Handling Persistent State Objects With the Persistent State Adapter.

  • No labels