Table of Contents

Interface ITestObject

Base interface for all test objects.

Namespace: HP.LFT.SDK
Assembly: HP.LFT.SDK.dll
Syntax
public interface ITestObject : ITestObjectDescriber

Properties

DisplayName

The object display name defined in the Application Model.

Declaration
string DisplayName { get; set; }
Property Value
Type Description
string

Parent

The parent test object of this test object. The child object must be obtained using the Describe method, otherwise, it returns null.

Declaration
ITestObject Parent { get; }
Property Value
Type Description
ITestObject
Remarks

For example, if the test object is a WebElement, the Parent is the IFrame or IBrowser test object that contains it.

Methods

CallFTMethod(string, params object[])

Calls a method or property of an OpenText Functional Testing test object.

Declaration
void CallFTMethod(string methodName, params object[] arguments)
Parameters
Type Name Description
string methodName

The name of the method or property to call.

object[] arguments

Additional arguments that are required for the method or property.

CallFTMethod<TResult>(string, params object[])

Calls a method or property of an OpenText Functional Testing test object.

Declaration
TResult CallFTMethod<TResult>(string methodName, params object[] arguments)
Parameters
Type Name Description
string methodName

The name of the method or property to call.

object[] arguments

Additional arguments that are required for the method or property.

Returns
Type Description
TResult

An object of the return type specified.

Type Parameters
Name Description
TResult

The return type.

Exists()

Checks whether this object exists in the AUT before the default object synchronization timeout elapses.

Declaration
bool Exists()
Returns
Type Description
bool

Exists(uint)

Checks whether this object exists in the AUT before the specified timeout elapses.

Declaration
bool Exists(uint timeout)
Parameters
Type Name Description
uint timeout

The time (in seconds) to wait for this object before returning the true or false result.

Returns
Type Description
bool

FindChildren<TChild>(IDescription)

Returns all the child test objects that match the specified test object type and description filter.
For example, you can use this method to retrieve all Web buttons on a Page with type="submit".

Declaration
TChild[] FindChildren<TChild>(IDescription selector) where TChild : class, ITestObject
Parameters
Type Name Description
IDescription selector

A description containing the set of properties and values that should be common to all objects that are returned.

Returns
Type Description
TChild[]

An array of child test objects.

Type Parameters
Name Description
TChild

The test object interface type to find. To avoid limiting to a specific test object type, use ITestObject.

GetDescription()

Returns a clone of the description for this test object. The test object must be obtained using the Describe method, otherwise, this method returns null.

Declaration
IDescription GetDescription()
Returns
Type Description
IDescription

GetSnapshot()

Captures a bitmap of this test object and returns a Image of it.

Declaration
Image GetSnapshot()
Returns
Type Description
Image

Image

GetTextLocations(string)

Returns all rectangle areas containing the specified text within this object (Windows only).

Declaration
Rectangle[] GetTextLocations(string textToFind)
Parameters
Type Name Description
string textToFind

The text string to find.

Returns
Type Description
Rectangle[]

GetTextLocations(string, Rectangle)

Returns all rectangle areas within the supplied rectangle that contain the specified text (Windows only).

Declaration
Rectangle[] GetTextLocations(string textToFind, Rectangle textArea)
Parameters
Type Name Description
string textToFind

The text string to find.

Rectangle textArea

An inner rectangle within this object.

Returns
Type Description
Rectangle[]

GetVisibleText()

Returns all visible text from this object.

Declaration
string GetVisibleText()
Returns
Type Description
string

GetVisibleText(Rectangle)

Returns all visible text within the supplied rectangle.

Declaration
string GetVisibleText(Rectangle textArea)
Parameters
Type Name Description
Rectangle textArea

An inner rectangle within this object.

Returns
Type Description
string

Highlight()

Highlights this object in the AUT.

Declaration
void Highlight()
Remarks

This may be useful when debugging a test.

HighlightMatches<TChild>(IDescription)

Highlights all children that match the specified test object type and description filter.

Declaration
uint HighlightMatches<TChild>(IDescription description) where TChild : class, ITestObject
Parameters
Type Name Description
IDescription description

A description containing the set of properties and values that is common to all objects to be are highlighted.

Returns
Type Description
uint

The number of object that match the provided description and were highlighted.

Type Parameters
Name Description
TChild

The test object interface type to highlight. To avoid limiting to a specific test object type, use ITestObject.

SetDescription(IDescription)

Replaces this test object's description with the supplied description.

Declaration
void SetDescription(IDescription description)
Parameters
Type Name Description
IDescription description

The new IDescription for this test object. (A clone of the provided Description is used.)

VerifyImageExists(Image, byte)

Checks whether a snapshot of this object contains the supplied image.

Declaration
Point? VerifyImageExists(Image imageToFind, byte similarity = 100)
Parameters
Type Name Description
Image imageToFind

The image to look for within the test object's snapshot.

byte similarity

Optional. The minimum similarity between the two images (as a percentage), above which the find is considered a match. Default = 100.

Returns
Type Description
Point?

the Point where the image was located, or null if it was not found.

Remarks

When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.

VerifyImageMatch(Image, ImageMaskArea, byte, byte)

Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel and RGB tolerance values.

Declaration
bool VerifyImageMatch(Image expectedImage, ImageMaskArea maskArea, byte pixelTolerance = 0, byte rgbTolerance = 0)
Parameters
Type Name Description
Image expectedImage

The image to compare to the test object snapshot.

ImageMaskArea maskArea

The mask area within the two images to use for the comparison.

byte pixelTolerance

Optional. The percentage of pixels that can differ between the two images, and still be considered a match. Default = 0.

byte rgbTolerance

Optional. The percent by which the RGB values of the pixels in the two images can differ, and still be considered a match. Default = 0.

Returns
Type Description
bool
Remarks

Returns true only if the mask areas match and the two full images are the same size.

When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.

VerifyImageMatch(Image, byte, byte)

Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel and RGB tolerance values.

Declaration
bool VerifyImageMatch(Image expectedImage, byte pixelTolerance = 0, byte rgbTolerance = 0)
Parameters
Type Name Description
Image expectedImage

The image to compare to the test object snapshot.

byte pixelTolerance

Optional. The percentage of pixels that can differ between the two images, and still be considered a match. Default = 0.

byte rgbTolerance

Optional. The percent by which the RGB values of the pixels in the two images can differ, and still be considered a match. Default = 0.

Returns
Type Description
bool
Remarks

When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.

Extension Methods

TestObjectExtensions.WaitUntilExists<T>(T)
TestObjectExtensions.WaitUntilExists<T>(T, int)
TestObjectExtensions.WaitUntil<T>(T, Func<T, bool>)
TestObjectExtensions.WaitUntil<T>(T, Func<T, bool>, int)