Forum Discussion

rmnrdi's avatar
7 years ago

compare object

I have a program that I need to check the properties of in two different states. TC only allows one object to be captured by object spy at a time.


Is there any way to do a side by side comparison of object properties? Export a list of properties and their values to a file of some type?


The only way I'm seeing how to do that now is to do screen shots (usually multiple) and compare them manually.


I'd like to be able to capture the properties of an object in one state, change the state and then compare the properties in the that state.


Is this currently possible?




  • No additional save, just a refresh of the variable as per below.



    procedure CompareObjects;
    tracePanel, PropertyNames, CollectionName, tfrmModifyTrace2 : OleVariant;
    //Get panel object
    tracePanel := Aliases.SettingsNavigator.frmModifyTrace2.VCLObject('Panel3');
    // Sets the name of the property collection
    CollectionName := 'TracePanelProps';
    // I want it to check all properties, so I leave the property name blank.
    Objects.Save(tracePanel, CollectionName);
    tfrmModifyTrace2 := Aliases.SettingsNavigator.frmModifyTrace2;
    tfrmModifyTrace2.MainMenu.Click('Manage|Get Library Trace');
    tracePanel := Aliases.SettingsNavigator.frmModifyTrace2.VCLObject('Panel3');
    Objects.Compare(tracePanel, CollectionName, true, lmMessage);

     Additionally... there is more information in the error than just "Object Compare error".  Any additional info/text would be useful.

18 Replies

  • tristaanogre's avatar
    Esteemed Contributor

    1) Store the object properties in the first state into some sort of structure.  Could be multiple variables, could be a JavaScript object, could be an array... anything.
    2) Write code to compare the properties of the object AFTER to the stored properties.


    That's one possible scenario.


    You could also create multiple property checkpoints... run them "before"... and run them "after".

    In short... the answer to your question is... yes, it is possible.  Depends upon what implementation you want to make as to how you will implement it.  I wouldn't use image comparisons for this.

    • rmnrdi's avatar

      Thanks for your reply tristaanogre. I guess I should have said:


      Is this currently possible with TestComplete? Or. Does TestComplete have a feature that accomplishes this?


      I'll look into doing that.




      • tristaanogre's avatar
        Esteemed Contributor

        The answer to that is... no, not that I am aware of.  Properties of an onscreen object are gathered in real time.  So, to compare the object properties in run time from one point to another requires creating some sort of storage and comparison as described.