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 - TEC1431274.
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. In the below image, test.tst is the subprocess.
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. For example, in the below image selected userDS and pwdDS.
It is possible to use the properties returned from the sub process in the VSM and/or in VSI response: