How to modify a dataset created from datafile and persist to Clipboard using Test Cycle
This example demonstrates how to modify the dataset created from a data file and persist the updated dataset to the Test Cycle Clipboard.
In Worksoft SaaS, the data is read from the existing data file into a dataset and modify the data within this dataset as per the requirement. The modified dataset can be persisted to the test cycle clipboard, which can be further viewed in the Test Cycle Clipboard Consolidation Reports. You can create a new Dataset using the "ddCreateDataSet" command and create a dataset for a data file using the "ddCreateDatasetFromADatafile" command. The data within the dataset can be modified using the "ddSetCellValueByName" command and the dataset can be persisted using the "ddPersistDatasetToTestCycleClipboard" command.
In the solution shown below, a dataset "InsuranceDetails" is created considering the Data Definition "HICC Details(W)".
Solution:
# | Command | Target | Value |
---|---|---|---|
To get the existing data file name with UDV binding | |||
1 | store | <#UDV_binding_here> |
DataFileName |
Create a DataSet by specifying the Data Definition Name | |||
2 | ddCreateDataSet | InsuranceDetails | HICC Details(W) |
To create a DataSet from the existing Datafile specified within the user defined variable | |||
3 | ddCreateDatasetFromADatafile |
${DataFileName}||<give filterName if required> | InsuranceDetails |
Modify the data within the created data set with respect to attribute name | |||
4 | ddSetCellValueByName |
InsuranceDetails(1,Age) | 45 |
To persist the modified data set to test cycle clipboard | |||
5 | ddPersistDatasetToTestCycleClipboard |
InsuranceDetails |
Tips, Tricks, Gotcha's & Best Practices:
- As a best practice, it is always advisable to define the variable names without any spaces and if you want to differentiate the words, use underscores.
- The variable name used in the 'Value' field of the Store command should not contain the following special characters which are not allowed: >, <, ==, !=, >=, <=, +, -, *, /, %, (, ).
- For "ddCreateDatasetFromADatafile" command, status for a Data File is mandatory at the target field.
- Status of the Data Definition can be optionally passed along with the name of the Data Definition. Allowed values for status are 'W'(WIP) and 'A'(Active). If the status value is not passed, the status of the Data Definition is assumed to be W(WIP).
- The "ddAddRows" command can be used to create new rows within the dataset