Files Actions

This article describes the Files Actions available in ScenarioBuilder.

ScenarioBuilder has four actions available in the Files Actions group.

  • File Exists
  • File Update Date
  • File Size
  • File Version

The Update Date, Size, and Version actions all read the properties available for a file. You can see these properties by right-clicking on the file in File Explorer and then clicking Properties from the pop-up menu.

SB Properties

File Exists

This action will check for the existence of a file. An example of how to use this action is to make sure a file exists before the script tries to use it. If not, then you can have it fail rather than continue. There are three properties for this action:

  • File Path - provide the full path and file name of the file you are checking (e.g. "c:\program files (x86)\automai\scenariobuilder\license\sblicense.lic")
  • Output Variable - provide a name for the variable that will hold the result of the file check (SUCCESS or FAILURE).
  • Scenario Section - this is used to identify the step as a global section that can be accessed from other scripts. Note that in order to use this property the script must be a Global scenario.

File Update Date

If the file exists, this action will retrieve the Date Modified property for the file. This information is stored in a variable. An example of how to use this action is with a process that updates a file. You can use this action to obtain the update date/time for the file and then verify it against current date/time to verify it was updated by the script. This action has three properties.

  • File Path - provide the full path and file name of the file you are checking (e.g. "c:\program files (x86)\automai\scenariobuilder\license\sblicense.lic")
  • Output Variable - provide a name for the variable that will hold the result of the update check (if successful it will hold the date/time of update, if the file doesn't exist it will report FAILURE). Note that the date and time are in a string format, not a date and time format.
  • Scenario Section - this is used to identify the step as a global section that can be accessed from other scripts. Note that in order to use this property the script must be a Global scenario.

File Size

This action will retrieve the size of a file (in bytes). An example of how to use this action is to verify the file isn't an empty (0 byte) file. There are three properties for this action.

  • File Path - provide the full path and file name of the file you are checking (e.g. "c:\program files (x86)\automai\scenariobuilder\license\sblicense.lic")
  • Output Variable - provide a name for the variable that will hold the file size (if successful it will hold the size of the file in bytes, if the file doesn't exist it will report FAILURE).
  • Scenario Section - this is used to identify the step as a global section that can be accessed from other scripts. Note that in order to use this property the script must be a Global scenario.

File Version

This action is only valid for executable (EXE) files. This action will obtain the File Version property. An example of how to use this action is to verify you have the correct version of an application before completing upgrade testing. It has three properties.

  • File Path - provide the full path and file name of the file you are checking (e.g. "c:\program files (x86)\automai\scenariobuilder\ScenarioBuilder.exe")
  • Output Variable - provide a name for the variable that will hold the version (if successful it will hold the File Version, if the file doesn't exist or the File Version property is empty it will report EMPTY).
  • Scenario Section - this is used to identify the step as a global section that can be accessed from other scripts. Note that in order to use this property the script must be a Global scenario.