ImageSetItem Object

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The ImageSetItem object provides a scripting interface to image set items stored in the Image Repository. These items are a collection of images you use in image-based tests. To learn more, see Image-Based Testing.

To obtain an ImageSetItem object in tests, use the following syntax:

ImageRepository.ImageSet_Name.ImageSetItem_Name

  • ImageRepository is the predefined name of the top-level object that provides access to image repository items.

  • ImageSet_Name is the name of the image set that contains the needed image. You can see this name in the Project Explorer panel.

  • ImageSetItem_Name is the name of the needed item in the image set. You can see it in the Items list of the Image Set editor.

Members

Example

The following code gets access to the specified image set (calculator) and simulates user actions over the specified items of this image set:

JavaScript, JScript

function TestCalc()
{
  // Specify the current device
  Mobile.SetCurrent("MyAndroidDev", 0);

  // Run Calculator and simulate touches on its buttons
  ImageRepository.launcher.TextView_Calculator.Touch();
  var MySet = ImageRepository.calculator;
  MySet.Button_5.Touch();
  MySet.Button_Question1.Touch();
  MySet.Button_2.Touch();
  MySet.Button_Equal.Touch();
}

Python

def TestCalc():
  # Specify the current device
  Mobile.SetCurrent("MyAndroidDev", 0)
  # Run Calculator and simulate touches on its buttons
  ImageRepository.launcher.TextView_Calculator.Touch();
  MySet = ImageRepository.calculator
  MySet.Button_5.Touch()
  MySet.Button_Question1.Touch()
  MySet.Button_2.Touch()
  MySet.Button_Equal.Touch()

VBScript

Sub TestCalc
  ' Specify the current device
  Call Mobile.SetCurrent("MyAndroidDev", 0)

  ' Run Calculator and simulate touches on its buttons
  Call ImageRepository.launcher.TextView_Calculator.Touch
  Set MySet = ImageRepository.calculator
  Call MySet.Button_5.Touch
  Call MySet.Button_Question1.Touch
  Call MySet.Button_2.Touch
  Call MySet.Button_Equal.Touch
End Sub

DelphiScript

procedure TestCalc();
var MySet;
begin
  // Specify the current device
  Mobile.SetCurrent('MyAndroidDev', 0);

  // Run Calculator and simulate touches on its buttons
  ImageRepository.launcher.TextView_Calculator.Touch();
  MySet := ImageRepository.calculator;
  MySet.Button_5.Touch();
  MySet.Button_Question1.Touch();
  MySet.Button_2.Touch();
  MySet.Button_Equal.Touch();
end;

C++Script, C#Script

function TestCalc()
{
  // Specify the current device
  Mobile["SetCurrent"]("MyAndroidDev", 0);

  // Run Calculator and simulate touches on its buttons
  ImageRepository["launcher"]["TextView_Calculator"]["Touch"]();
  var MySet = ImageRepository["calculator"];
  MySet.Button_5["Touch"]();
  MySet.Button_Question1["Touch"]();
  MySet.Button_2["Touch"]();
  MySet.Button_Equal["Touch"]();
}

See Also

Testing Android Applications (Legacy)
Image-Based Testing
Desktop Property (Android Testing)
ImageRepository Object

Highlight search results