Ask a Question

Descriptive Programming with Regular Expression

nimishbhuta
Frequent Contributor

Descriptive Programming with Regular Expression

Hello, 

 

I have gone through different post related to descriptive programming in TestComplete but not found any appropriate answer to implement this. 

 

My requirement about Descriptive programming is as follows : 

 

I am writing custom subroutine for clicking a button on any page as I don't want to use standard method of TestComplete.

    This subroutine will click on the button irrespective of any web application it is not defined for any webpage, 

 For ex : In UFT, I can write Browser("name:=.*").Page("title:=.*").WebButton("name:=.*").Click

From the above example, I can click on any button on any web page, so it is not binded with any application or object repository. 

 

".*" in the code refer Regular Expression which does not relate to any specific object.

 

I would like to have similar thing in TestComplete, I am not interested in creating object from the application and then passing to my subroutine. 

 

Let me know how can it be done with the example. 

 

Regards,

 

Nimish

 

 

       

         

13 REPLIES 13

Hi,

 

The final decision for every case depends on the tested application.

Assuming that the tested application was created with the testability in mind (and this is less than often nowadays), then, usually, the bast approach is a combination of Aliases and .FindXXX(). The peculiarity here is that Aliases must be carefully created in advance, but not automatically during recording. This approach usually provides best balance of code maintainability and performance.

Pure Aliasing usually can be implemented for simple static applications only.

Pure .FindXXX() approach might lack performance and be less visually clear, but, depending on the tested application, it may be the only way of controls' identification, unfortunately.

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
tristaanogre
Esteemed Contributor

That's why we run a blend of the two...  A large part of our AUT is static so Mapping the objects ahead of time takes less code and, therefore, less code maintenance. It gives us better performance (less interpretive code to execute and less overhead in the "find" logic) and gives us the added benefit of cached object identities.  However, there are some dynamic portions to our applications so, in those cases, we use the "Find" methods on a parent object that is, itself, mapped... best of both worlds.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
nimishbhuta
Frequent Contributor

Hello, 

 

Can you please provide with a sample example using find and conditional mode,so that I get an idea how to implement it?

 

Regards,

 

Nimish

Hi,

 

Conditional mapping: https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/mana...

Finding objects: https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/searching.html

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: