Question
Not able to use Data set in Test run for a strategy
Hi,
We are trying to use Pega Unit test case to validate a strategy. We have created a File data set to read the JSON input.Our JSON file has only one attribute. In the test run pane for the strategy element(switch) ,we specified to run the strategy as Data set and gave the Data set name and specified the key name in our JSON file in the Subject ID field. When we tried to run the Test ,we are getting the below error
Data set <Data set Name> cannot be used for test runs because it does not support reading records by subject ID.
Please let us know what did we miss here? are File Data sets not supposed to be used for Pega Unit testing? do we need to use other data sets like database table,..
Hi, it is not possible to use file data sets because they do not define a key that can be used to query the data. So, yes, you will have to use database table, decision data store, etc.
This said, there is nothing that stops you from populating the source from a file data set by 1) creating a data flow in the appropriate class, 2) using the file data set as source in the data flow, 2) configuring the data flow to write to the abstract destination, 4) run the data flow.