File Object

Applies to TestComplete 15.64, last modified on June 12, 2024


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.


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



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");


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


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


  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


Highlight search results