File Object

Applies to TestComplete 14.50, last modified on April 22, 2021

Description

Use the File object to work with individual items of the Stores > Files collection of your project from your scripts. For example, you can check whether the Stores > Files item and an external file are identical.

To get the File object, use the following notation: Files.File_Item, where File_Item is the unique name of the file in the collection. You can view and change file names in the Name column of the File editor.

Requirements

The File object is available only if your project contains the Stores project item with the Files collection in it.

Members

Example

The following code snippet demonstrates how you can compare a stored item (a baseline copy) with an actual file.

JavaScript, JScript

  if (!Files.OrdersList_old.Check("C:\\Work\\OrdersList.txt"))
    Log.Warning("List of orders was changed");

Python

if not Files.OrdersList_old.Check("C:\\Work\\OrdersList.txt"):
  Log.Warning("List of orders was changed")

VBScript

  If Not Files.OrdersList_old.Check("C:\Work\OrdersList.txt") Then 
    Log.Warning("List of orders was changed")
  End If 

DelphiScript

  if not Files.OrdersList_old.Check('C:\Work\OrdersList.txt') then
    Log.Warning('List of orders was changed');

C++Script, C#Script

  if (!Files["OrdersList_old"]["Check"]("C:\\Work\\OrdersList.txt"))
    Log["Warning"]("List of orders was changed");

See Also

Stores

Highlight search results