staticimage


Static Image Connection

The Static Image connection allows to test file based images. Usage:

  • Testing of systems producing image file output (screen shots, data visualization etc.).
  • Testing of live image files (continuously updating ones).
  • Debugging of failed image comparisons from other connections, such as screen shots taken through the Screenshot command or saved automatically by the Image Doctor feature.

Connection:

  • To connect manually from the Login Dialog choose the Static Image connection type in the drop down and provide the image file path.
  • To connect from a test script use the Connect command (TPR scripts) or the connect() method (Java test scripts). The argument URL must be a standard file URL such as "file://<path>". The URL may be also used together with the c/--connect CLI option to establish the connection on the Robot start up. Examples:

TPR test scripts:     Connect file://C:/Users/John/myscreenshot.png 
Java test scripts:    connect("file://C:/Users/John/myscreenshot.png");

The connection by default refuses key events. TPR test scripts relying on this connection report a syntax error in any Press, Type or Typeline commands. This is intended to make it clear that static images do not consume any key events. To suppress this behavior and make the client consume key events (and discard them silently) see the client preferences. The connection checks the image file size and last modified time at regular intervals. When an update is detected it reloads the image. This mechanism allows the connection to test systems generating graphical output to an image in the file system. This behavior may be modified in the connection Preferences. Advanced URL Syntax:

  • To load an image stored in a ZIP or JAR file use the URL like "file://<archive_path>!/<image_path_in_archive>". For example, to load an image called "screen.png" from the "C:\testdata\images.jar" JAR file where the image is zipped into a folder called "examples" use:

Connect file://C:/testdata/images.jar!/examples/screen.png

  • Relative paths are resolved against the Robot installation directory. For example to load an image called "screen.png" located in the Robot install folder use:

Connect file://screen.png

  • A common practice is to place the test images to the Robot project folder. The URL can be then constructed using the Project path variables to ensure safe project move/copy. For example to connect to an image called "screen.png" located in the "images" folder inside the project directory use:

TPR test scripts:     Connect file://\{_PROJECT_DIR}/images/screen.png
Java test scripts:    connect("file://" + getVariableAsString("_PROJECT_DIR") + "/images/screen.png");