Working with remote files
You can use a File transport with a File Access resource to publish or consume remote file contents using File Transport Protocol (FTP) or SSH File Transport Protocol (SFTP) in HCL OneTest™ API.
About this task
To work with remote files, you must bind a File transport to a File Access resource and configure the file transfer by using either SFTP or FTP protocols.
Procedure
-
Create an identity resource with the sign-in credentials. From the
Physical view, click . See The Identity window.
Note: An FTP connection uses the value anonymous for the Username or for the Password when these fields are left blank.
-
Create a File Access resource and specify the host and the protocol as either FTP or SFTP. See
The File Access window.
- If required, specify the port override.
- You can specify the sign-in credentials by selecting Specify username and password or select Use Identity to use the created identity.
- To verify that the configured connection works, click Test Connection.
-
Create a named logical resource by performing the following steps:
- Click Logical View. from the
- Enter a name for the new resource.
-
Bind the logical File to the physical File Access by performing the following steps:
-
Configure the logical File.
Notes:
- The directory specified on the logical File for an FTP is always relative to the home directory of the user. See Transport test result for an FTP with a relative path.
- For an SFTP, the pathname can either be relative to the home directory of the user or explicitly described through an absolute path, as shown in Transport test result for an SFTP with an absolute path.
-
Click Test Transport to test the connect to the remote file system and
verify the existence of the specified directory.
-
Set the Last Modification Delay, which is specified in seconds to defer
consumption of a file until it is completely uploaded. See The Consuming tab in the File window.
You can use a File transport in a test or stub like a file on the local computer. However, appending to a remote file is not allowed as shown in The Config tab in the Publish window.