isFile() | Zoho QEngine Help

isFile()

1. Overview 

The isFile() function checks whether the input is a valid file object. It returns a boolean value (true or false) based on whether the specified input can be treated as a file. This is especially useful before performing further file operations to avoid errors in test execution.

2. Syntax 

<variable> = files.<fileObject>.isfile();

Parameter
Description
<variable>
Defines the response returned by the isFile() function. It represents a Boolean value indicating the validity of the file.
<fileObject>
Specifies the file object to be checked. This can be a file downloaded, invoked via URL, or loaded from saved files.

3. Example

  1. //perform file function action on a downloaded file
  2. assertFileDownload("downloadedfile.txt",5,errorhandling.STOP_ON_ERROR);
  3. DownloadFile = File("downloadedfile.txt");
  4. IsFile = DownloadFile.isfile();

 

  1. //to fetch file using invoke URL and perform file functions
  2. response = invokeUrl
  3. [
  4. url:"<downloadURL>"
  5. type: GET
  6. ];
  7. info(response.isFile());