Blur
9 years agoContributor
Textnode problem
I map the textnode, "This field is required.", then I run the test. Test fails because textnode cannot be found. I check to see what's wrong and the problem is that every time I map the textnode, i...
Hi,
Note: This reply is done assuming you doing "scripting".
I feel some times the objects which are already mapped in TestComplete requires lot of time beacuase of following reasons:
So what I do?
Yes, I don't map objects. I simply do it scripting way.
I do my own "end to end" mapping of those objects in my script. (mapping all parent objects). Thus no need to search object at run time and time gets saved.
Sample code:
//Controls var textBox_Username; var textBox_PasswordBox; var button_Login; //Mapping Function function MapObjectsForLogin() { var LoginPage = Aliases.browser.LoginPage; textBox_Username = LoginPage.Panel("LoginPanel").Panel("LoginPanelBody").Panel("LoginForm").Textbox("username"); textBox_PasswordBox = LoginPage.Panel("LoginPanel").Panel("LoginPanelBody").Panel("LoginForm").Passwordbox("password"); button_Login = LoginPage.Panel("LoginPanel").Panel("LoginPanelBody").Panel("LoginForm").Link("login"); } //Login Sample Function function Login(username, password) { MapObjectsForLogin(); textBox_Username.SetText(username); textBox_PasswordBox.SetText(password); button_Login.Click(); }
I've only been using keyword testing because that's what was taught during the training. For keyword testing, I run into many problems. I've tried not fully mapping the objects but that comes back to bite me later on. If there are two textboxes and I don't map fully map them then TestComplete might see them as the same object. Do you run into that issue with mapping via scripting?
what really works for us:
1) do the mapping first! map all the elements needed manually and disable automatic mapping as this will screw your mapping.
2) check the mapping criteria for each item carefully. the criteria has to be unique so that the element will always be found. we use idstr or objectidentifier as often as possible (developers can set the value) or of this is not possible, select a unique label or similar stuff.
3) use extended find for all mapped elements that have you have mapped as in 2) and remove all other stuff in between (like .panel, .cell, .table,...), which can change all the dtime.
I'm mapping it manually but I have been mapping the whole object tree. When deleting the "stuff in between", are you doing that for the alias only or actual mapped objects as well? I'm not too familiar with extended find. It definitely sounds like what I need to do though.
I am doing it for both.
But with this I am not 100% sure if it is the best way. It works for me quite well, but sometimes we have performance issues (when an object is way down in a big tree and there are lots of levels removed).
I asked for help in this thread:
But unfortunately noone could help with my problem.
Therefore we have written a recursive function that refreshes the tree. I insert this function in front of actions that sometimes fail in my tests.
jsc wrote:what really works for us:
1) do the mapping first! map all the elements needed manually and disable automatic mapping as this will screw your mapping.
2) check the mapping criteria for each item carefully. the criteria has to be unique so that the element will always be found. we use idstr or objectidentifier as often as possible (developers can set the value) or of this is not possible, select a unique label or similar stuff.
3) use extended find for all mapped elements that have you have mapped as in 2) and remove all other stuff in between (like .panel, .cell, .table,...), which can change all the dtime.
Same here except for extended find. We explicitly map everything.