Table of Contents

Interface ITestObject

Namespace
HP.LFT.SDK
Assembly
HP.LFT.SDK.dll

Base interface for all test objects.

public interface ITestObject : ITestObjectDescriber
Inherited Members
Extension Methods

Properties

DisplayName

The object display name defined in the Application Model.

string DisplayName { get; set; }

Property Value

string

Parent

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

ITestObject Parent { get; }

Property Value

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.

void CallFTMethod(string methodName, params object[] arguments)

Parameters

methodName string

The name of the method or property to call.

arguments object[]

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.

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

Parameters

methodName string

The name of the method or property to call.

arguments object[]

Additional arguments that are required for the method or property.

Returns

TResult

An object of the return type specified.

Type Parameters

TResult

The return type.

Exists()

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

bool Exists()

Returns

bool

Exists(uint)

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

bool Exists(uint timeout)

Parameters

timeout uint

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

Returns

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".

TChild[] FindChildren<TChild>(IDescription selector) where TChild : class, ITestObject

Parameters

selector IDescription

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

Returns

TChild[]

An array of child test objects.

Type Parameters

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.

IDescription GetDescription()

Returns

IDescription

GetSnapshot()

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

Image GetSnapshot()

Returns

Image

Image

GetTextLocations(string)

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

Rectangle[] GetTextLocations(string textToFind)

Parameters

textToFind string

The text string to find.

Returns

Rectangle[]

GetTextLocations(string, Rectangle)

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

Rectangle[] GetTextLocations(string textToFind, Rectangle textArea)

Parameters

textToFind string

The text string to find.

textArea Rectangle

An inner rectangle within this object.

Returns

Rectangle[]

GetVisibleText()

Returns all visible text from this object.

string GetVisibleText()

Returns

string

GetVisibleText(Rectangle)

Returns all visible text within the supplied rectangle.

string GetVisibleText(Rectangle textArea)

Parameters

textArea Rectangle

An inner rectangle within this object.

Returns

string

Highlight()

Highlights this object in the AUT.

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.

uint HighlightMatches<TChild>(IDescription description) where TChild : class, ITestObject

Parameters

description IDescription

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

Returns

uint

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

Type Parameters

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.

void SetDescription(IDescription description)

Parameters

description IDescription

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.

Point? VerifyImageExists(Image imageToFind, byte similarity = 100)

Parameters

imageToFind Image

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

similarity byte

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

Returns

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.

bool VerifyImageMatch(Image expectedImage, ImageMaskArea maskArea, byte pixelTolerance = 0, byte rgbTolerance = 0)

Parameters

expectedImage Image

The image to compare to the test object snapshot.

maskArea ImageMaskArea

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

pixelTolerance byte

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

rgbTolerance byte

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

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.

bool VerifyImageMatch(Image expectedImage, byte pixelTolerance = 0, byte rgbTolerance = 0)

Parameters

expectedImage Image

The image to compare to the test object snapshot.

pixelTolerance byte

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

rgbTolerance byte

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

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.