getFilecontent() | Zoho QEngine Help

getFilecontent()

1. Overview

The getFilecontent() function returns the content stored in the specified input file. It is commonly used in test cases to validate file data, read values for further logic, or check against expected content.

2. Syntax

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

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

3. Example

  1. //perform file function action on a file saved locally
  2. FileContent = files.ztest.getfilecontent();

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

  1. //to fetch file using invoke URL and perform file functions
  2. File =  invokeURL[
  3. url : "<downloadURL>"
  4. type:GET
  5. ];
  6. FileContent = File.getfilecontent();