Ask a Question

TestComplete in built Files.Compare Method ReferenceError: Files is not defined

Petewilson
Contributor

TestComplete in built Files.Compare Method ReferenceError: Files is not defined

 

When i run the below script to compare 2 files based off the Files.Compare Method in the TestComplete documentation here, I get an error in the log, ReferenceError: Files is not defined. Problem is, it is intermittant so sometimes it will run sometimes it won't

 

Can someone explain if i have done something wrong as Files is a built in method, so shouldn't need defining but i may have something wrong.

 

function TestCompare()
{
  var Design = "Edwardian_Design_1";
  var DevSettingsText = "D:\\TestComplete\\Input\\Mobile\\" + ProjectSuite.Variables.application + "\\Test\\" + Design + "_DevSettingsText.txt";
  var BaselineDevSettingsText = "D:\\TestComplete\\Input\\Mobile\\" + ProjectSuite.Variables.application + "\\Baseline\\" + Design + "_BaselineDevSettingsText.txt";
  
  Log.Message("DevSettingsText = " + DevSettingsText);
  Log.Message("BaselineDevSettingsText = " + BaselineDevSettingsText);
  
  if (!Files.Compare(DevSettingsText, BaselineDevSettingsText))
    Log.Warning("Developer Settings did not match baseline for " + Design);
}

 

1 REPLY 1
rraghvani
Valued Contributor

The Files Object belongs to Stores as highlighted here,

rraghvani_0-1670435927902.png

If you have your two files stored in Files, then the compare will work. 

 

 

cancel
Showing results for 
Search instead for 
Did you mean: