Forum Discussion

SuperTester's avatar
SuperTester
Contributor
5 years ago
Solved

Hierarchy Change Check

Hello! I'm wondering if there is a tool is or function that would allow test complete to compare the object Hierarchy of a process against a previous build of a process. Or how to make a keyword t...
  • Wamboo's avatar
    Wamboo
    5 years ago

    Hello,

     

    You can always use this solution:

     

    function compareObject() {
      var obj = Sys.Process("notepad++");
      var FileName = "C:\\work\\ObjectInfo.txt"; // the path to the file the snapshot is saved to
      var SaveRecursive = true; // properties of the object's child objects are saved as well.
      var SaveAllProperties = true;
      var AdditionalProperties = "The file contains the snapshot of an object that corresponds to notepad++";
      var SaveFields = true;
      var SaveMethods = true;
      
      // Saves the snapshot
      aqObject.SaveObjectSnapshotToFile(obj, FileName, SaveRecursive, SaveAllProperties, AdditionalProperties, SaveFields, SaveMethods);
      let xml = aqFile.OpenTextFile("C:\\work\\ObjectInfo.txt", aqFile.faRead, aqFile.ctANSI);
      let result = aqFile.Compare("C:\\work\\ObjectInfo.txt", "C:\\work\\ObjectInfo2.txt")
    }

    the default object returned from SaveObjectSnapshotToFile its an .xml saved with .txt extension so to be more specific You can always parse this .xml into .json and Log differences in Test Log results.