Forum Discussion

Petewilson's avatar
2 years ago

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