Skip to content

Commands for Accessing Contents of and Persisting Files within the "Files" module

There are a great many commands in Worksoft SaaS that are related to accessing, reading contents from and manipulating (updating and persisting back) the files that exist within the "Files" module of your project.

In Worksoft SaaS, the commands can be used to realize the following common use cases from within automated tests:
  1. Reading contents of TXT, JSON, XML and Microsoft Excel files that exist within the "Files" module of your project.
  2. Storing (persisting) DataSets in memory as new or updates to existing XML, Json or Microsoft Excel files into/within the "Files" module of your project
The table(s) below lists the commands in the ascending alphabetic order within each category along with a brief description of the purpose behind the command. By clicking on the hyperlinked command name in the table(s) below, you can review more detailed information about a specific command that includes the syntax for you to follow when using the commands. Please note that these commands (constructs) are supported within Worksoft SaaS application (Edit Test Script screen) only and NOT supported in QaSCRIBE test authoring tool.
Command Purpose
ddCreateDataSetFromExcelFile This command is used to create a new dataset in memory with a name specified in the 'Value' field
ddCreateDataSetFromJsonFile
This command is used to create a DataSet from an Json File that is present within the "Files" module in the project. The command takes as input two parameters (a) In the "Target" field, the "Json Filename" and (b) In the "Value" field a DataSet name. This dataset must have been created using the "ddCreateDataSet" command within a test instruction that is executed within the same test but prior to (ahead of) the test instruction which contains the “ddCreateDataSetFromJsonFile" command.
ddCreateDatasetFromXmlFile
This command is used to create a DataSet from an Xml File that is present within the "Files" module in the project. The command takes as input two parameters (a) In the "Target" field, the "Xml Filename" and (b) In the "Value" field a DataSet name. This dataset must have been created using the "ddCreateDataSet" command within a test instruction that is executed within the same test but prior to (ahead of) the test instruction which contains the this command.
ddPersistDataSetToExcelFile This command is used to persist a Dataset in memory into an Excel file
  • On selecting the 'Override' option, the content gets overridden from the dataset to the excel file
  • On selecting the 'Append' option, the content gets appended to the excel file
ddPersistDataSetToJsonFile 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.
  • 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.

  • 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.
ddPersistDataSetToXmlFile This command is used to persist a DataSet in the test’s memory either as a new XML file or as an update (override) to an existing XML file into the “Files” module of your project. The name for the XML 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.
  • If the DataSet is created within the test from an XML file that exists within the “Files” module of your Project using the command ‘ddCreateDataSetFromXmlFile’, then this command will override that original file with the contents of the “DataSet” passed into the “Value” field of this command.

  • If the DataSet was created some other way, meaning not using the command ‘ddCreateDataSetFromXmlFile’, then a new XML file will be created and persisted into the “Files” module of your project. The keys for the XML will be the attributes of the data definition mapped to the Dataset and values in the XML will be the data from the Dataset.
storeContentFromFile This command is used to "store" the contents of a "file" of txt, json and xml file formats present within the "Files" module in the project. The command takes as input two parameters (a) In the "Target" field, the "Filename" and (b) In the "Value" field a Variable name into which the file contents will be stored into. . 

Feedback and Knowledge Base