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:
- Mapping of objects is not done "end to end".
- i.e. not all parent objects of the required object are mapped. Only few of the parent objects are mapped
- Example if required object is "F" and hierarchy is A - B - C - D - E - F.
- Then TestComplete may map A - C - F. Not all parent objects
- Thus while run time (i.e. at playback time) TestComplete internally tries to implement "FindChild()" to find that object on page. This will certainly take some time, if the requried object is placed way down in the hierarchy.
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();
}