Text (OCR) - test subject

  • on all platforms

The text (OCR) test subject represents a text read from the screen applying OCR feature on image capture.


This test subject can be evaluated only if image capture is configured.

In Test editor:

Check that the title is displayed in correct position

In the JavaScript API:

// Image assertion example
await suitest.assert.ocr([
  {
    region: [40, 20, 20, 10], // left, top, width, height
    val: 'The app title',
    type: suitest.COMP.EQUAL
  }
]);

OCR currently works reliably only when capturing the image over the HDMI with the WingBox. If you want to use the Suitest Camera app or a USB camera, check the stream to ensure there are no reflections on the screen and the content is in focus through the corresponding lens. Additionally, define a region to achieve the highest possible reliability.

Assertion location

Suitest can read and evaluate texts across the whole screen or only in a specific region.

Region is a rectangle defined by the following 4 parameters:

  • left - horizontal distance of the top-left region corner from the left side of the screen, defined in %
  • top - vertical distance of the top-left region corner from the top side of the screen, defined in %
  • width - width of the region, in %
  • height - height of the region, in %

Defining the region

Language

Helping the OCR feature to better understand what is the language that the text on the screen is using - improves the result accuracy.

If you are missing a language needed for testing, please contact our customer support.

Value comparators

As in case of all string comparisons in Suitest, the OCR operation can use the following comparators between the defined value and the text read from the whole screen / specified region:

  • = - both values are exactly the same
  • != - there is a difference (can be just a single letter difference)
  • contains - read value contains specified text
  • does not contain - read value does not contain specified text
  • ends with - read value ends with specified text
  • does not end with - read value does not end with specified text
  • starts with - read value starts with specified text
  • does not start with - read value does not start with specified text