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

  1. Create an identity resource with the sign-in credentials. From the Physical view, click General > Identity. See The Identity window.
    Figure 1. The Identity window
    Image of the Identity window.
    Note: An FTP connection uses the value anonymous for the Username or for the Password when these fields are left blank.
  2. Create a File Access resource and specify the host and the protocol as either FTP or SFTP. See The File Access window.
    Figure 2. The File Access window
    Image of the File Access configuration window.
    1. If required, specify the port override.
    2. You can specify the sign-in credentials by selecting Specify username and password or select Use Identity to use the created identity.
    3. To verify that the configured connection works, click Test Connection.
  3. Create a named logical resource by performing the following steps:
    1. Click Files > File from the Logical View.
    2. Enter a name for the new resource.
  4. Bind the logical File to the physical File Access by performing the following steps:
    1. Right-click the file to bind from the Logical View.
    2. Navigate in the menu displayed to Set Binding in > Environment > to File Access<credentials-host>, as shown in Binding the File.
      Figure 3. Binding the File
      Image showing the file binding options screen.
  5. Configure the logical File.
    Notes:
  6. Click Test Transport to test the connect to the remote file system and verify the existence of the specified directory.
    Figure 4. Transport test result for an FTP with a relative path
    Image of the result screen for an FTP when Test Transport is clicked.
    Figure 5. Transport test result for an SFTP with an absolute path
    Image of the result screen for an SFTP when Test Transport is clicked.
  7. 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.
    Figure 6. The Consuming tab in the File window
    Image of the screen to set the delay of last modification.
    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.
    Figure 7. The Config tab in the Publish window
    Image of the Config tab in the Publish window.