Forum Discussion

MyG0t's avatar
MyG0t
Occasional Contributor
8 years ago

Object Validation - Best Practices?

Hi -

I'm trying to begin implementing an Enterprise solution for automation, and I've got a lot to learn!  Scale-ability and reliability is incredibly important. Are there any best practices, or tips-n-tricks for object validation using TestComplete?

 

For instance, when starting a new project, I like to validate all elements of the application are displayed - images, text, drop downs and their values, input boxes, buttons, etc.  The applications I've been working with are fairly small and self-contained, so there aren't hundreds of objects per screen.  I've been creating a checkpoint for each of the mapped objects (see below).  

 

Small sample:

aqObject.CheckProperty(NameMapping.Sys.browser.Screen_HEADER, "contentText", cmpEqual, "Welcome!");

aqObject.CheckProperty(NameMapping.Sys.browser.Screen_Customer, "contentText", cmpEqual, "Customer");

aqObject.CheckProperty(NameMapping.Sys.browser.Screen_Item, "contentText", cmpEqual, "Item");

aqObject.CheckProperty(NameMapping.Sys.browser.Screen_Quantity, "contentText", cmpEqual, "Quantity");

aqObject.CheckProperty(NameMapping.Sys.browser.Screen_Help, "contentText", cmpEqual, "Help?");

 

There maybe 20-30 objects for a single screen, maybe more.. and typically multiple screens.  The above sample would illustrate text labels for a screen, but there could be images, a drop down with 100+ values, dynamic results from a search, input fields, etc.  

 

Is this type of test even valuable?  

Is this the most efficient way to validate all screen objects?

 

 

Also, if there are any typical automated test practices that you use.. feel free to share, or even tests that you include in many/all your automated projects.

 

  

4 Replies

    • MyG0t's avatar
      MyG0t
      Occasional Contributor

      Thanks for the reply, this works pretty well so far. 

       

      Follow-up question;  

      Is there a way to implement wild cards or ignore specific comparisons?  

       

      I keep getting a failure because a ViewState value changes, dynamically, whenever the site is loaded.  I have tried to enable the "Read content from a server" option with no luck, and it seems wild card (*) does not apply to this checkpoint.

       

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Looking at your mapping that you're using... you're mapping text boxes on screen straight off the browser.  I'm assuming, though, that they are actually child objects of a page...and if they are child objects of a page, they are possibly also child objects of other objects on the page (DIV panels, Tables, etc.).

         

        Now, this is going to take a bit of rework, but if you remap your objects to not be straight off the browser but actually be "contained" in some other object, you can do an Object check point and have it capture child objects and check properties of the whole object tree at once.  A bit more granular than a full page comparison... but, again, it's going to take a bit of re-engineering on your part of your mapping configuration.