Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Sep 09, 2019 14:38

Injecting an image

Different mobile applications employ the builtin device camera to "look" at the outside world and perform different operations based on the image that the camera records. Examples of this would be a barcode-reader application, or a bank check scanning application.

When testing these applications using a Perfecto Lab device, you need to provide the application with an image that mocks the use of the camera. This is supported by Perfecto's image injection.

Step-by-step guide


Notes

Image injection is only supported for:

  • The front and back cameras of Android devices and the back camera of iOS devices. It is not supported for the front camera of devices running an iOS version prior to iOS 11.
  • A single application that is instrumented for the image injection on the device. If an application on the device, other than the currently tested application, is instrumented for injection, uninstall it before testing the current application.

To start image injection:

    • Manual testing - use the Inject image widget, provide the Repository location of the image to use, and the application identification information.
    • Perfecto Automation - use the Start image injection function (under Device/Image injection) and supply the image's Repository Key.
    • UFT - use the StartImageInjection function and supply the image's Repository Key.
    • Selenium/Appium - use the mobile:image.injection:start Perfecto command (using executeScript) to supply the image's Repository Key.

Installing the application

To support this feature, the application must prepared for image injection during the installation process.

To prepare the application properly:

  • Manual testing - install the application using the Install app widget. After providing the application's repository location, there are two steps of instrumentation. The first instrumentation step is for object instrumentation and not affected by this functionality. The second instrumentation is sensor instrumentation - set the value to True.