Skip to content

ddPersistDataSetToJsonFile (Accessing Contents of and Persisting Files within the "Files" module)

Compatible with:
  • Purpose
  • This command is used to persist a DataSet in the test’s memory either as a new JSON file or as an update (override) to an existing JSON file into the “Files” module of your project. The name for the JSON file has to be provided as part of the “Value” field and the “DataSet” must be provided in the “Target” field of the Test Instruction containing this command.
  • 1. If the DataSet is created within the test from an JSON file that exists within the “Files” module of your Project using the command ‘ddCreateDataSetFromJsonFile’, then this command will override that original file with the contents of the “DataSet” passed into the “Value” field of this command.
  • 2. If the DataSet was created some other way, meaning not using the command ‘ddCreateDataSetFromJsonFile’, then a new JSON file will be created and persisted into the “Files” module of your project. The keys for the JSON will be the attributes of the data definition mapped to the Dataset and values in the JSON will be the data from the Dataset.
  • To create a DataSet, Array Creation & Manipulation commands must be used before this command.
  • When the DataSet used in the “Value” field of the test instruction containing this command is not created anywhere during the run time before this command gets executed, the test run gets aborted with an error "For one or more Instructions within the Test Script "" that use the "" command, the Dataset name provided in the 'Target' field does NOT exist in the scope of the Test Scenario" message.”
  • Syntax
  • ddPersistDataSetToJsonFile (dataSetName, JsonFileName)
  • Target (mandatory)
  • dataSetName
  • Value (mandatory)
  • JsonFileName
  • Return Value
  • N/A
  • Errors & Exceptions   
  • Condition Error/Exception Message
    When dataset is not defined The dataset passed as input does not exist in the scope of the run.

 


 

Feedback and Knowledge Base