How to Reset a Dataset for Each Transaction

book

Article ID: 14918

calendar_today

Updated On:

Products

CA Application Test Service Virtualization CA Continuous Application Insight (PathFinder)

Issue/Introduction

Dataset will be reset when it is loaded in DevTest, which is when the VS is deployed.

To reset a dataset for every transaction, create a subprocess test case and configure a dataset in it. Then use the subprocess test case with a Subprocess step inside the VSM.

The dataset should reset each time the subprocess is invoked.

 

Cause

 

N/A

Environment

All supported releases and platforms of DevTest.

Resolution

Instructions:

1. You will need to save the value, you will look for in the dataset, to a property. In this example, we want to save an argument value.

  • It is possible to add the "Request Data Copier" DPH in the request side during the virtual service creation and configured it to copy the arguments key to the property "request_<argumentName>".
  • It is also possible to add a filter to the Listener step and save the argument value from the request payload during the VSM execution. For more details on how to save a value from execution to a property see the knowledge document - https://knowledge.broadcom.com/external/article?articleId=14958

2. Add a Sub Process step to the VSM.

  • Add a Subprocess step to the VSM after the Router step.
  • The Subprocess step needs to be configured to run a subprocess test case.
  • If there is no test case, create a new test case and make it as a Sub Process. Select the check box "This is a subprocess" in the Test case information.  

3.  Create a subprocess to run the Data Set.

  • The Test Case, test.tst, was created and set as a subprocess
  • The "Subprocess Input Parameters" will be the property that is coming from the VSM. In our case, "request_user" is the property from the VSM request payload that will be used in the subprocess.
  • The sub process test case contains an "Output Log Message" step and a data set. That is all this sub process will use.
  • The data set is an Excel spreadsheet, but it can be a CSV file or database table.
  • The data set needs to be set as "Local" and "At end of data,"  Execute: "End the test”.
  • The sample dataset contains userDS and pwdDS
  • Add the "Ensure Properties Are Equal" assertion to the test step.
  • This assertion compares the value of "userDS", from the dataset, and "request_user", that comes from the VSM request.
  • If the properties are equal, the assertion will return True and the test will be ended.
  • When the test is ended, the result will be returned to the VSM.
  • If the properties are not equal, the test will loop through all the data set rows and end.

4. Return the values from the subprocess execution to be used with the virtual service.

  • In the VSM, Subprocess step, select the "Result Properties" that returns from the sub process.
  • It is possible to use the properties returned from the sub process in the VSM and/or in VSI response:

 

Additional Information

For more details regarding Subprocess refer to the Documentation in the version of DevTest you are running

Section Create a Subprocess Test Case

Section Subprocess Example

Section Execute Subprocess

Attachments

1558717996901000014918_sktwi1f5rjvs16ury.png get_app
1558717978947000014918_sktwi1f5rjvs16urp.png get_app
1558717976593000014918_sktwi1f5rjvs16uro.png get_app