Photo and video simulation

Digital Lab's photo and video simulation lets you simulate the capturing of images and videos.

Prepare for photo and video simulation

Using Digital Lab's photo and video simulation, you specify the image or video to use instead of the actual output of the camera. You can then use these images or videos to test your app.

When you perform simulation of a photo, Digital Lab replaces the camera output with the selected file, when you tap the Take a picture button on the device. When you perform simulation of a video, Digital Lab replaces the camera output with the selected file, when you end the video recording session on the device.

If you are recording test code, two steps are listed: a file upload step and a simulation step.

To prepare for simulation, create a packaged version of the app. For details on how to package an app, see App packaging and signing services. The packaged app must be uploaded to the lab. For details, see Manage apps.

Performing simulation

To use photo and video simulation, make sure that you have a remote view of a device and that the Control Panel is open. For details, see Device access window.

Note: Photo and video simulation is supported only for packaged iOS and Android apps. The apps need to be uploaded to Digital Lab.

  1. Activate simulation mode.

    1. For a photo, click the photo simulation button .
    2. For a video, click the video simulation button .

    The Simulate Photo or Simulate Video dialog box opens.

  2. In the Simulate dialog box, provide a file, one at a time, in one of the following ways:

    1. Paste in the URL of the image or video file.
    2. Browse for a file on a local or network machine.
    3. Drag and drop a file (not supported for UFT).
  3. Click the uploaded image to select it. A green checkmark indicates this is the image to be used for simulation.
    You can prepare all image and video files for your test at once. See Guidelines for photo and video simulation for information on the valid file types and sizes. If you have uploaded multiple files, click the photo or video simulation button and select the file to use the next time your device takes a picture or video.

    Tip: If you do not change your selection, the test continues to use the same photo or video each time you take a picture or record a video.

  4. Click OK to activate camera simulation. When simulation mode is active, the simulation button in the Control Panel is displayed within a blue frame.
  5. On your device, navigate to the screen in the app from where you are taking a picture or video.
  6. Click the camera button to take a picture, or click the Start Recording button, proceed with your recording session and click Stop.
  7. Repeat the above steps for all the images or videos you want to replace.
  8. To deactivate simulation, click the photo or video simulation buttons, select the No Simulation box, and click OK.

Back to top

Guidelines for photo and video simulation

When using photo and video simulation for replacing images or videos, follow these guidelines:

  • The maximum number of files you can download on a device is 100.
  • The files should not consume more than 50% of the device's free disk space. Make sure that you have sufficient space on your device. If there is insufficient space and the video to be used for simulation cannot be uploaded, simulation fails.
  • The format of the video to be used for simulation must be supported by the app.

  • The supported image formats are: JPG, GIF, PNG, and BMP. iOS also supports TIF files. The uploaded TIF files may display as broken images, but they can still be used for simulation.
  • The supported video formats are: For Android: 3GP, MP4, and MKV. For iOS: MOV, MP4, and M4V.
  • The maximum upload file size for images is 5 MB. The maximum upload size for videos is 20 MB with 1.5 GB of free memory for Android devices, and 40 MB for iOS devices.
  • The uploaded files are only valid for the current session. After the test or remote view session is finished, the files are erased.
  • Photo and video simulation is supported for the standard static camera and video mechanisms. Simulation may not be possible for apps that utilize a camera for scanning areas or prepare images for further processing or animations.
  • Simulation may not be possible if you customize the built-in camera settings.
  • On Android devices, set the saveToPic parameter to true (false by default) to save the images or videos to a subfolder in the device's photo gallery. For example, modify the recorded step:

    Device("Device").UploadMedia "sample.png","C:\sample.png"

    to

    Device("Device").UploadMedia "sample.png","C:\sample.png",True

Android X specific: 

  • Photo and barcode simulation can only be used one at a time. If your app uses both photo and barcode simulation, deactivate one before activating the other. For automation, ensure that you use a stop operation before switching between simulations.

  • The format of the video to be used for simulation must be supported by the app.

  • When you deactivate the simulation, all the files uploaded for the simulation are deleted from the device.

  • When using video simulation, the real video is stored by the app on the device.

Back to top

See also: