File Object

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The File object allows you to get access to the specified item stored in the Files section of the Stores collection from your scripts. For example, you can check whether the needed Stores item and any external file are identical.

To address an individual file of the Files collection, use the following notation: Files.File_Item, where File_Item is the unique name of the file within 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