cancel
Showing results for 
Search instead for 
Did you mean: 

AngularJS framework implemented with no unique Id or name mapping for objects

SOLVED
New Contributor

AngularJS framework implemented with no unique Id or name mapping for objects

Our Dev team recently implemented Angluar JS for a new application and they are not using any Unique IDs or name mapping for objects/web elements.

 

With TestComplete, I am unable to identify any of these objects and name mapping is also showing just basic values with indexes (I have added a screenshot for the same)

 

Is there a way to workaround this?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: AngularJS framework implemented with no unique Id or name mapping for objects

We had a similar requirement recently and I found that only DIVs and standard HTML and CSS tags and attributes  are identified in TC-14 object browser by default. On these objects that are identified, you need to check the Properties of the objects like @tristaanogre advised.

Also custom data attributes are a helpful thing to look at as @cunderw said.

 

Note that TestComplete either uses the "id" attribute or the "name" attribute to identify the web objects by default on DIVs.

see Tools -> Current Project Properties -> Open Applications -> Web Testing -> Object Identification 

 

Also, for proprietary UI controls and Angular JS controls, you need to have support within TestComplete to use special tags and attributes to identify objects.

see Tools -> Current Project Properties -> Object Mapping

For example for DevExpress it's here: https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/devexpr...

Supported Browser Versions IN TEST COMPLETE 14

https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/angular...

 

Additionally, you can get any custom HTML elements to be idenfitied - otherwise placing IDs on them won't help.

For this, refer to TestComplete Web - working with custom elements

 see Tools -> Current Project Properties -> Open Applications -> Web Testing -> Custom Attributes 

 

In any case, you really have to get back to the DEV team and if required have a live session with them to show that you are not able to identify their objects for automation testing. And if you can try to get them to add the IDs on DIVs at the least that's a good point to start.

 

(And the first image you shared: The panels are all DIV tags in the page, as far as I remember. Note that using "Extended Find" feature is very helpful and necessary when doing the NameMapping - because the tree of the DIV tags cannot be guaranteed in a web application generally.)

View solution in original post

15 REPLIES 15
Community Hero

Re: AngularJS framework implemented with no unique Id or name mapping for objects

Well, for starters, rather than going to NameMapping, I'd go to the Object browser and examine those objects.  By default, NameMapping uses what it things, at the time of recording, are the best criteria.  This might not always be the case.  So, in Object Browser, you should be able to see all of the properties available for those objects.  WIth that view, you should be able to find some additional properties that might contain some more unique identifying factors such as className, innerHTML, contentText, etc.  Note, these are just examples, I'm not necessarily endorsing them as the BEST properties to use.


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
Vegas Thrill Rider
Extensions available
New Contributor

Re: AngularJS framework implemented with no unique Id or name mapping for objects

Thank you for the reply Tristaanogre.

 

I looked at the Object Tree (screenshot attached) too and was unable to find any properties which can serve as unique. And this is an example of only text boxes, there are number of checkboxes with similar issues.

 

My question is, if AngularJS is implemented in such a way, are we only left with option of API testing using tools like Protractor (AngularJS specific), or is there a way to use TestComplete too.

 

Thank you.

 

 

 

 

 

Community Hero

Re: AngularJS framework implemented with no unique Id or name mapping for objects

I would say that, rather than throwing up your hands and taking whatever the DEVs give you, leverage the benefits of automated testing and go back to them and argue that, if they want the automation to be successful long term, they should implement Angular to give you the ability to identify objects easier.

That said, your screenshot didn't show the WHOLE property list. Nor did it show the properties of the other panels.  Keep in mind, NameMapping uses BOTH the hierarchy of objects AND the properties of an object to identify it.  So, the panel that "contains" the text box, you MIGHT be able to get something out of it in the HTML or className properties.  Then, if you can identify the panel uniquely, then the Textbox will have a better identification criterium.


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
Vegas Thrill Rider
Extensions available
Highlighted
Community Hero

Re: AngularJS framework implemented with no unique Id or name mapping for objects

Check your custom data attributes, it's possible there are useful IDs there. You can do that by clicking the expand box next attributes in the object browser.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Occasional Contributor

Re: AngularJS framework implemented with no unique Id or name mapping for objects

We had a similar requirement recently and I found that only DIVs and standard HTML and CSS tags and attributes  are identified in TC-14 object browser by default. On these objects that are identified, you need to check the Properties of the objects like @tristaanogre advised.

Also custom data attributes are a helpful thing to look at as @cunderw said.

 

Note that TestComplete either uses the "id" attribute or the "name" attribute to identify the web objects by default on DIVs.

see Tools -> Current Project Properties -> Open Applications -> Web Testing -> Object Identification 

 

Also, for proprietary UI controls and Angular JS controls, you need to have support within TestComplete to use special tags and attributes to identify objects.

see Tools -> Current Project Properties -> Object Mapping

For example for DevExpress it's here: https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/devexpr...

Supported Browser Versions IN TEST COMPLETE 14

https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/angular...

 

Additionally, you can get any custom HTML elements to be idenfitied - otherwise placing IDs on them won't help.

For this, refer to TestComplete Web - working with custom elements

 see Tools -> Current Project Properties -> Open Applications -> Web Testing -> Custom Attributes 

 

In any case, you really have to get back to the DEV team and if required have a live session with them to show that you are not able to identify their objects for automation testing. And if you can try to get them to add the IDs on DIVs at the least that's a good point to start.

 

(And the first image you shared: The panels are all DIV tags in the page, as far as I remember. Note that using "Extended Find" feature is very helpful and necessary when doing the NameMapping - because the tree of the DIV tags cannot be guaranteed in a web application generally.)

View solution in original post

New Contributor

Re: AngularJS framework implemented with no unique Id or name mapping for objects

Thank you guys for all the info.

I looked through the application earlier using "Developer Tools" to find any attributes, but didnt find anything unique.

 

This time around I have used attributes & data set in Test Complete and have added screenshots for the same. Still couldn't find any attributes which can be used to identify objects uniquely.

 

For reference, I have added screenshot of application browser too.

 

(Last resort is going to the Dev team and asking them too add some unique values, which can be used for object identification)

Community Hero

Re: AngularJS framework implemented with no unique Id or name mapping for objects

Hi,

 

> Last resort is going to the Dev team and asking them too add some unique values, which can be used for object identification

 

This is not the last resort, but one of the primary requirements that QA (and don't mix QA activities with test activities due to the usual words overloading popular nowadays) must require from Development if Management wants to have stable and reliable tests automation.

The last resort is to spend your time and efforts in attempts to find a set of properties (and custom attributes) that will make it possible to identify required web elements within test code. (Because development solely made a decision to use a library/technology that was created without test automation in mind).

More about custom attributes support in TestComplete: https://support.smartbear.com/testcomplete/docs/app-testing/web/general/object-identification/using-...

 

 

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/
================================
Super Contributor

Re: AngularJS framework implemented with no unique Id or name mapping for objects

"This is not the last resort, but one of the primary requirements that QA"...  referring to work with Dev.

In all honesty, I blame SmartBear (and Ranorex but this is not a Ranorex board) sales machines for this expectation among leadership. It is not an uncommon thing for an organizations' leadership to buy how "easy" things are from the sales pitches of the SmartBear sales folks. I have had to overcome this expectation set many times. So if the poster's leadership is not prepared for this message, the OP has some work to do.

Community Hero

Re: AngularJS framework implemented with no unique Id or name mapping for objects

Hi,

 

This is what trial period is for. Smiley Happy For sure, all test automation products work with notepad and simple hand-crafted login web pages. But again - this is QA's job to analyse project, its technologies and guarantee product's testability. The fact that most projects skip QA activities and tend to blindly use the most "modern" open source technologies and libraries (which were created to solve some certain current task without a lot of testability consideration), so this fact is just one of the critical risks for you as a tester. And your management must be aware about this.

 

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/
================================