Test Complete Interview Questions
Test Complete Interview Questions
Name Mapping:
Though the object name format used in TestComplete lets you uniquely identify an object in the
system, it has at least two inconveniences:
1.
The object name depends on object properties that are not persistent. For instance,
window and control identification attributes (class name and caption) can change from
one application build to another. To run your tests successfully, you may need to replace
the old object names with new ones in the entire project before running the tests.
2. Quite often, the object names are long and unreadable.
To solve these problems, TestComplete offers the Name Mapping project item. Using this item
you can assign custom names to objects
We can map the objects in two ways
Click Point and fix. When you do that, the TestComplete window gets minimized down
so you can view the entire desktop.
2. Move the mouse pointer to the window or object you want to select. As you move the
mouse pointer over objects, a red selection frame appears around the object under it.
Tip: You can interact with applications during the process, for example:
Once the desired object is highlighted with the red selection frame, press Ctrl+Shift+A. (The
shortcut can be customized in the Global Shortcuts dialog.)
Object Spy:
The procedure is as follows:
1.
Click the target glyph () and keep the mouse button pressed. When you do this, the
mouse pointer turns into and the TestComplete window gets minimized down so you can
view the entire desktop.
2. Drag the glyph onto the window or object that you want to select. As you move the glyph
over objects, a red selection frame will appear around the object under the glyph.
3. Release the mouse button once the desired object is highlighted with the red selection
frame.
4. TestComplete will capture the specified object and display its information.
Note: Applications can contain objects that are displayed only after you perform a specific action
in the application (for example, a right-click or mouse hovering). You cannot select such objects
using the target glyph because the glyph does not allow interacting with applications during the
object selection process
Sub GmailLogin()
Set iexplore = Aliases.IEXPLORE
Set Page = iexplore.pageGmailLogin
Page.Wait
' Enter User Name
NameProperty = Array("ObjectType", "ObjectIdentifier")
ValueProperty = Array("Textbox", "Email")
UserName = Page.FindAllChildren(NameProperty, ValueProperty, 7)
UserName (0).SetText ("prakash")
End Sub
'For Finding Objects, we need to click on object spy, and pass the Unique Name Properties and
Value Properties
'7 = Depth of the User Name
Find
FindAll
FindChild
Find
Find method is used to search the object in the desired hierarchy. Searching is based on the set of
values of the specified properties.
Syntax
TestObj.Find (PropName, PropValues, Depth, Refresh)
Where
TestObj: Refers to a reference (object) from where the search for the desired object will begin
PropName: Set of unique properties of object for identification.
PropValue: Set of values of the properties used for object identification.
Depth: Refers to the level till what the TestComplete needs to drill down to find the object.
Refresh: It instructs TestComplete what to do if the object we are searching is not present in the
TestComplete Object cache. This is an optional field.
Output: Object
For example we need to perform click operation on a web button whose text changes at run
time.
Approach:
First we need to identify some properties which will uniquely identify the object on webpage.
Here we chooses the class and text property of the button. After the identification of the
properties we need to store all the properties and relevant values in two separate array.
VarA=array ("Class, Text")
Varb=array ("WebButton, Click Here")
Once we have defined the array, next we need to find the object for which we are searching
Set obj=testObj.Find(VarA,VarB,10)
In this statement testObj refers to the reference node from where the search will began and
search for the object that has the properties that of properties stored in VarA and values equal to
values stored in VarB. And 10 tell the TestComplete to search for the object till the 10th level of
the reference node and not more than that and store the result in an object.
To determine whether the search was successful or not, we can use Exists method on obj object.
If the Exists method return false, it implies that search was unsuccessful else if it returns true,
search was successful and we can perform the click operation
If obj.Exists then
obj.click
else
msgbox "No object found"
End if
FindAll
FindAll method is used to search the object in the desired hierarchy i.e. in both objects and child
objects. Searching is based on the set of values of the specified properties. The output is in the
form of the set of collection of the object which matches the criteria.
Syntax
TestObj.FindAll(PropName,PropValues,Depth,Refresh)
Where
TestObj: Refers to an reference (object) from where the search for the desired object will begin
PropName: Set of unique properties of object for identification.
Output: Object
For example we need to perform click operation on a web button containing text as Login on a
webpage
Approach:
As we know the web button is a child element of the page. So we can use FindChild method here.
For that firstly, we need to identify some properties which will uniquely identify the object on
webpage. Here we chooses the class and text property of the button. After the identification of
the properties we need to store all the properties and relevant values in two separate array.
VarA=array ("Class","Text")
Varb=array ("WebButton","Login")
Once we have defined the array, next we need to find the object for which we are searching
Set obj=testObj.Find(VarA,VarB,10)
In this statement testObj refers to the reference node from where the search will began and
search for the object that has the properties that of properties stored in VarA and values equal to
values stored in VarB. And 10 tell the TestComplete to search for the object till the 10th level of
the reference node and not more than that and store the result in an object.
To determine whether the search was successful or not ,we can use Exists method on obj object
.If the Exists method return false, it implies that search was unsuccessful else if it returns True,
search was successful and we can perform the click operation
If obj.Exists then
obj.click
else
msgbox "No object found"
End if
So, these are the some other ways by which we can identify the dynamic objects in
TestComplete.
TestedApps in TestComplete:
TestedApps holds a list of TestedApp objects, each of which corresponds to a tested application.
The TestedApps object is available only if your project contains the Tested Applications project
item
We will use the TestedApps by calling as shown in below
Call TestedApps.<Application Name>.Run
The above command will launches the specified application