Inject an image

On an open device, you can inject an image to mock the use of the camera. This is helpful for testing application actions, such as focus or image placement, in apps that rely on camera usage, for example barcode readers or bank check scanning apps. Image injection supports uploaded images in .jpeg, .jpg, .png, or .bmp format. The file size cannot exceed 150 MB.

For image injection to work, the application to test must have been installed with sensor instrumentation enabled. In addition, the app needs to stay in the foreground.

Watch this short video to see how you can inject an image. For automated testing, you can use the existing Start Image Injection and Stop Image Injection commands.

To inject an image:

  1. On the open device, start the application you want to test and activate the camera. Make sure the app stays in the foreground.

  2. On the device toolbar, click the image icon .

  3. In the Inject image dialog box, select the location of your image file: Repository (default) or Computer.

  4. Depending on your selection in step 2, do the following:

    • Repository: Search for and select the repository file you want to use.

      You can search by tag name, if applicable. If a file is associated with tags, a tag symbol appears below the file name, along with the number of tags associated with the file. To view the tag names, move the pointer over the tag icon .

    • Computer:

      1. Click ADD IMAGE.

      2. Browse to the file you want to use.

      3. Select the file and click Open.
        The file loads.

  5. Click INJECT IMAGE

    Perfecto injects the file and your app should reflect the result shortly.

  6. Perform the required testing.

  7. When done, click the image icon  again and stop the injection.