cancel
Showing results for 
Search instead for 
Did you mean: 

From UFT to TestComplete

Highlighted
Contributor

From UFT to TestComplete

Hello,

   Our shop is currently evaluating TestComplete. Ive used UFT for several years. Can someone give me an example what TestComplete's approach to what is defined as 'descriptive programming' in UFT looks like? For example, how would the following line look in TestComplete scriptive - we will be using VBScript.


Browser("title:=TitleName.*").Page("title:=.*").Link("html tag:=A","text:=Log Off","html id:=ctl00_logOffButton").CLick

 

Thanks

9 REPLIES 9
Community Hero
Community Manager

Re: From UFT to TestComplete

Hi @Southpaw,

 

If you get used to work with XPath expressions, you may find the EvaluateXPath and FindChildByXPath methods extremely helpful. Just specify the needed XPath expression in the method, like //A[starts-with(@href, 'javascript:')] and TestComplete will find the corresponding object on the entire page or based on the parent object you specify. Please read the following article for more information:

https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/finding-objects...

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: From UFT to TestComplete

Tanya, 

  XPath is my preferred way to identify objects. So this is really helpful to know. I appreciate the suggestion. 

Thanks

Chris

Community Hero

Re: From UFT to TestComplete

Personally, I steer clear of XPath... and here's why... finding something via XPath will return something... but that something might not be a UI object that can be operated on with the standard wrapper actions/methods from TestComplete.  Our pal @AlexKaras can give a better explanation.  

The primary method (preferred and recommended) for object identification in TestComplete is via the NameMapping engine which builds an object hierarchy structure where objects are identified by a) what they are a child object of and b) a set of object properties used as identifciation criteria.  So, your example would look, in the TestComplete programming, like

Aliases.browser.pageMyPage.buttonLogoff.Click()

 

See https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/abou... and all related articles.


Robert Martin
[Community Expert Group]
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
Extensions available
Contributor

Re: From UFT to TestComplete

@tristaanogre  In UFT, the Object Spy would return the XPath to most objects. So for example, in your example, that .click on the LogOffButton would work well by just supplying the XPath property. I just tried Test Complete ObjSpy and it doesnt look like the XPath is something it can locate. I can see where it would not be a favorable method to use. Correct me if Im wrong in my findings regarding not being able to actually spy the XPath as Im relatively new to Test Complete.

Thanks.

 

Community Hero

Re: From UFT to TestComplete

Hi,

 

Yes, you are correct, neither Object Spy, nor Object Browser provide XPath expression as locator for some web element.

I think that the main reason for this is because TestComplete does not use XPath as a primary means to locate web elements and because XPath is specific for web elements, but TestComplete has a different unified approach that works for desktop, web and mobiles.

(In addition: why XPath? Why not css, for example? Smiley Wink )

 

And in addition to everything been said by all previous repliers:

TestComplete identifies and searches for tested objects within the tested application using arbitrary set of properties and their values (which may be wildcarded). By default, TestComplete tries to uniquely identify objects by using a subset of predefined properties (like id, etc.).

With this in mind: There are three main ways to search for the tested objects in TestComplete:

-- Direct objects referencing as provided in the Object Browser. You may see this type of referencing in the line above the list of properties available for the selected object within the objects tree. This is most simple, most straightforward and least stable way of addressing.

For your example, the reference might look like this:

Sys.Browser("*").Page("*").Link("ctl00_logOffButton").Click

 

-- Objects may be searched for using .FindXXX() methods (e.g. FindChild(), FindAlChildren(), FindAliasChild(), ...). The use of these methods is more preferable than XPath because of their much greater flexibility, performance and some other pecularities related to web page markup.

In theory, FindXXX methods can be chained like in your example, but this is inconvenient and is rarely used in real code.

 

-- The most advanced and recommended approach is to use Namemapping with Aliases. With this approach, you need first to build a tree of mapped objects and then adjust Aliases tree to your most convenience. After that your code may look like in Robert's example (i.e. Aliases.browser.page.logOffButton.Click) and remain pretty stable for certain page design changes.

 

I also would like to recommend you:

a) Read documentation, which is pretty detailed and descriptive for TestComplete; and

b) Watch https://support.smartbear.com/screencasts/testcomplete/reliable-tests-for-dynamic-objects/ and other relevant recordings from the https://support.smartbear.com/screencasts/testcomplete/ page.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Contributor

Re: From UFT to TestComplete

I appreciate all of the replies. As mentioned, ive had my skillset in UFT way back when it was  Astra QuickTest. So migrating my skills to TC will be a process. Im not married to XPath. In fact, just started using it within the last couple of years. from my experience with it, it's one obj prop vs, at least two to sometimes 4 obj props to identify a single web element, e.g., an edit field. That said, my evaluation of this tool has been rewarding. Ive spent a couple of months getting it to integrate to VS and TFS -- and getting it to run tests via a build def. So havnt had the time to explore the scripting engine capabilities as much as I would have preferred to do. Sorry for the bold font,

Community Hero

Re: From UFT to TestComplete

Hi,

 

> Im not married to XPath

...neither I am saying that XPath cannot be used in TestComplete test code. Smiley Happy Sometimes this is the last resort due to the HTML markup of the tested web page.

But at least you should be aware about these pecularities of the search by XPath in TestComplete:

https://community.smartbear.com/t5/TestComplete-Functional-Web/Click-method-not-accepted-in-chrome/m...

https://community.smartbear.com/t5/TestComplete-Functional-Web/Using-Xpath-in-TestComplete/td-p/1511...

https://community.smartbear.com/t5/TestComplete-Functional-Web/FindChildByXPath-is-not-working-on-th...

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: From UFT to TestComplete


@Southpaw wrote:

we will be using VBScript.

Some technical summary for your convenience: https://community.smartbear.com/t5/TestComplete-General-Discussions/Which-script-language-do-you-pre...

(Yes, I understand that other reasons like your current knowledge or other considerations might matter.)

 

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2
Top Kudoed Authors