ITestee Methods

AddFilter

Adds a global image processing filter. All filters will be applied to the current screen of the subject under test before further processing (image recognition, ocr) takes place.

Syntax:

void AddFilter(
	IImageFilter filter
)

Parameter

Description

filter

Type: ImageFilter An implementation of an IImageFilter that should be applied, e.g. Select.

ClearFilter

Removes all globally registered image processing filters.

Syntax:

void ClearFilter()

FindImage

Executes an image search (single result) on the subject under test.

How TestResults.io works with image references:

The engine will try to find the image that is specified by imageName or all images contained in the folder (incl subfolders) specified by imageName. imageName refers to the relative location within the Images directory of the project, folders are separated by dots. E.g. "Screens.MyScreen.MyImage". However the designer automatically generates classes so you can use intelliSense to specify the image, the same image would be provided with TestImages.MyProject.Images.Screens.MyImage or just Images.Screens.MyImage if the correct using is set.

Syntax:

IEngineResult FindImage(
	string imageName,
	TimeSpan searchDuration = default,
	ImageDetectionParameters parameters = null,
	params IImageFilter[] filters
)

Parameter

Description

imageName

Type: String Name of the image to find (see above for details)

[searchDuration]

Type: TimeSpan Defines how long the search should be run while no result is found

[parameters]

Type: ImageDetectionParameters Additional settings used for this search

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the image will be searched for

Return Value: Returns an IEngineResult with the position where the image was found

FindImages

Executes an image search (multiple results) on the subject under test.

Syntax:

IList<IEngineResult> FindImages(
	string imageName,
	TimeSpan searchDuration = default,
	ImageDetectionParameters parameters = null,
	params IImageFilter[] filters
)

Parameter

Description

imageName

Type: String Name of the image to find (see above for details)

[searchDuration]

Type: TimeSpan Defines how long the search should be run while no result is found

[parameters]

Type: ImageDetectionParameters Additional settings used for this search

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the image will be searched for

Return Value: Returns a list of IEngineResult with all positions where the image was found

FindText

Executes a text search (single result) on the subject under test

Syntax:

IEngineResult FindText(
	string content,
	TimeSpan searchDuration = default,
	OcrEngineParameters parameters = null,
	params IImageFilter[] filters
)

Parameter

Description

content

Type: String Text to find

[searchDuration]

Type: TimeSpan Defines how long the search should be run while no result is found

[parameters]

Type: OcrEngineParameters Additional settings used for this search

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the text is search for

Return Value: Returns an IEngineResult with the position, detected text and corresponding accuracy where the specified text was found as a best match, i.e. highest accuracy

FindTexts

Executes a text search (multiple results) on the subject under test

Syntax:

IList<IEngineResult> FindTexts(
	string content,
	TimeSpan searchDuration = default,
	OcrEngineParameters parameters = null,
	params IImageFilter[] filters
)

Parameter

Description

content

Type: String Text to find

[searchDuration]

Type: TimeSpan Defines how long the search should be run while no result is found

[parameters]

Type: OcrEngineParameters Additional settings used for this search

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the text is search for

Return Value: Returns a list of IEngineResults with all positions, detected text and corresponding accuracy where the specified text was found.

GetCurrentScreen

Returns the screen of the currently active SUT.

Syntax:

Bitmap GetCurrentScreen(
	params IImageFilter[] filters
)

Parameter

Description

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen before the image is taken

Returns a Bitmap of the filtered current screen.

GetRemoteClipboard

Overload List

Name

Description

GetRemoteClipboard (int?)

Returns the clipboard content of the subject under tests.

GetRemoteClipboard (bool, int?)

Returns the clipboard content of the subject under tests.

GetRemoteClipboard (int?)

Returns the clipboard content of the subject under tests. The method waits until the subject under test signals that there is new content in its clipboard. If the subject under test signals the availablity of new content before this method is called the call will return instantly with the information of the remote clipboard. If no new content is received during waitTimeout, the last content that was received is returned.

Note that for most VNC servers no new content is signaled, when the same content is copied again, or an empty text selection is copied.

Syntax:

string GetRemoteClipboard(
    int? waitTimeout = null
)

Parameter

Description

[waitTimeout]

Type: Nullable<Int32>

Maximum time in milliseconds the function waits to receive content from the remote clipboard. Defaults to t.Properties.ClipboardTimeOut if null or not set.

Return Value: The content of the SUT clipboard.

GetRemoteClipboard (bool, int?)

Returns the clipboard content of the subject under tests. The method waits until the subject under test signals that there is new content in its clipboard. If the subject under test signals the availablity of new content before this method is called the call will return instantly with the information of the remote clipboard. If no new content is received during waitTimeout, the last content that was received is returned, but wasTimeoutTriggered is set to true.

Note that for most VNC servers no new content is signaled, when the same content is copied again, or an empty text selection is copied.

Syntax:

string GetRemoteClipboard(
	out bool wasTimeoutTriggered,
	int? waitTimeout = null
)

Parameter

Description

wasTimeoutTriggered

Type: Boolean

Set to true if the provided timeout passed. To make sure that you got the most accurate content, you can check this property

[waitTimeout]

Type: Nullable<Int32>

Maximum time in milliseconds the function waits to receive content from the remote clipboard. Defaults to t.Properties.ClipboardTimeOut if null or not set.

Return Value: The content of the SUT clipboard.

GetText

Reads the text on the screen of the subject under test

Syntax:

string GetText(
	OcrEngineParameters parameters,
	params IImageFilter[] filters
)

Parameter

Description

[parameters]

Type: OcrEngineParameters Additional settings used for this search

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the text is to be found

Return Value: Returns all text found on the current screen

RefreshScreen

Forces the internal data structure to be updated with a new screenshot from the subject under test

Syntax:

void RefreshScreen()

RegisterForUpdateCheck

Registers a callback for graphical updates from the SUT. Must be unregistered afterwards by calling UnregisterFromUpdateCheck with the corresponding GUID. Use t.WaitUntilStableScreen or t.WaitUntilScreenUpdate for easier use of this functionality.

Syntax:

Guid RegisterForUpdateCheck(
	Action<double> updateHandler,
	double allowedEuclideanDistance,
	params IImageFilter[] filters
)

Parameter

Description

updateHandler

Type: Action<Double>

Method to call once an update happens

allowedEuclideanDistance

Type: Double

Defines how much of the reference image can be changed

filters

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the screenshot is taken

Return Value: Returns a GUID to identify the callback that has to be provided when unregistering.

SaveImage

Saves an image with the specified name and additional information which might be setup via the global properties

Syntax:

IEngineResult SaveImage(
	Bitmap image,
	string name,
	out string persistedName
)

Parameter

Description

image

Type: Bitmap

Image to save

name

Type: String

Specifies the base name of the image

persistedName

Type: String

Contains the fully qualified name, generated by the TestResults.io runner

SetRemoteClipboard

Sets the clipboard content of the subject under test

Syntax:

void SetRemoteClipboard(
	string content
)

Parameter

Description

content

Type: String

Information to put into the remote clipboard

TakeScreenshot

Takes a screenshot and saves it with the specified name and additional information which might be setup via the global properties.

Syntax:

IEngineResult TakeScreenshot(
	string name,
	params IImageFilter[] filters
)

Parameter

Description

name

Type: String

Specifies the base name of the screenshot

[filters]

Type: IImageFilter[]

Specifies a collection of possible filters that are used to pre-process the current screen image before the screenshot is taken

UnregisterFromUpdateCheck

Unregisters a callback for graphical updates from the SUT.

Syntax:

void UnregisterFromUpdateCheck(
	Guid updateCheckId
)

Parameter

Description

updateCheckId

Type: Guid

Identifier received while registering the update check

Last updated