In Manual view
Create a Mobile Test Object and its locator
To create a new Mobile test object, do as follows:
- Select File > New > Test Object from the main menu.
- In the displayed New Test Object dialog, provide a name for the new test object, then click OK button.
A new test object is created under the Object Repository of Katalon Studio.
Katalon Studio selects Attributes by default to locate mobile test objects. A test object is typically built up by a number of properties. Check on one or multiple Detect object by in the Object's Properties table to compose a Selected Locator for the object. During test execution, Katalon Studio bases on such information to detect an object.
In the following example, Katalon Studio tries to find any object on AUT with text to satisfy the defined criteria during execution.
Add an object's property (before v7.6)
You can add multiple object properties to the Object's Properties table. Please note that object properties cannot share the same name in an object.
- In the Object's Properties panel, click Add.
In the displayed Add property dialog, specify the required information:
- Name: The object property's name. You can select one of the provided options (class, css, id, name, title, xpath) or enter a name manually.
- Match condition: The condition is used for detecting the target object during execution.
- Value: The value that completes a match condition.
The new property is added to the properties list as configured above. You can also change the properties' values here.
Validate Test Object on AUT (before v7.6)
You can add test objects to Mobile Object Spy to verify if the object can be detected successfully in the application under test. Refer to Spy Mobile Utility for more details regarding how to validate captured objects against the application under test.
To add an object to Mobile Object Spy, right-click on the item to open its context menu and select the option.
In Script View
Script View allows defining and handling Test Objects programmatically. The following is a usage example demonstrating how to do that:
- Refer to existing objects using the
// Find an object which was defined already in Object Repository
myPredefinedObject = findTestObject(‘android.widget.TextView - App’)
- Create a new object programmatically using the
// Create a new object programmatically
myNewObject = new TestObject(“TestObjectID”)
- Add a property to an object using the
// Add property to Test Object, a property is defined by:
// property name,
// condition type,
// property value,
// a boolean value to indicate if the property will be used to identify the object during execution
myNewObject.addProperty(“class”, ConditionType.EQUALS, “android.widget.TextView”, true)