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

Last updated: Aug 16, 2020 11:56

Simulators simulate iPhones and iPads on a Mac host. They are great for lightweight and early testing, when you need to get started and receive quick feedback. They create an operating environment that looks and functions like the mobile device model, but with limitations. Memory management, network management, and file management are all inherited from the host OS, and some simulators do not expose all of the functionality available in the target device, such as the camera or hardware sensors. In addition, simulators leverage the system resources from the host Mac OS, so it is not possible to obtain real performance data from tests.

Therefore, before testing on simulators, be aware that simulators are designed for basic functional testing. They cannot test:

  • Hardware components
  • Real-world user conditions
  • Gestures

Testing on simulators requires an .app file (not an .ipa file). This is a restriction imposed by Apple. Simulators cannot run .ipa files. Those files require real devices. For more information on creating a simulator build that is compatible with all iOS model simulators, see Create an iOS simulator buildTo receive the .app file, check with your development or engineering department.

For more information on running your app in the simulator, see this Apple article.

On this page:

If you are already familiar with Perfecto and want to switch from a real device to a simulator, take a look at the supported capabilities.
If you are new to Perfecto, watch the video and see the detailed steps under 1 | Configure and run your test and 2 | View execution results.

Supported Appium and Selenium versions

As a best practice, we recommend that you select only the version of the Appium client to use and let the natural dependency and compatibility between Appium server and Selenium client versions take care of the rest. If you need to select a specific Selenium client, you must make sure that the client version is compatible with the selected version of the Appium client.

Perfecto supports Appium server 1.12.0 or later. See also Supported platforms.

Supported devices and OS versions

Perfecto supports simulators for iOS versions 12.x and 13.x on the following devices.


5s, 6, 6 Plus, 6s, 6s Plus, SE (1st and 2nd generation), 7, 7 Plus, 8, 8 Plus, X, Xs, Xs Max, XR, 11, 11 Pro, 11 Pro Max


iPad 5th, 6th, and 7th generation, mini 2, 3, 4, and 5, Air (1st generation), 2, and 3, Pro (9.7-inch, 12.9-inch), Pro 2nd generation (10.5-inch, 11-inch, 12.9-inch), Pro 3rd generation (11-inch, 12.9-inch), Pro 4th generation (12.9-inch)

Demo video

Watch the video to see how to work with simulators in Perfecto.

For your convenience, following is the script used in the video. You can run it in your environment with the following changes:

  • <your_token>: The Perfecto security token for your user. For information about obtaining a token, see Generate security tokens.
  • <your_cloud_URL>: The URL for your Perfecto cloud.
Simulator sample script
package io.appium.java_client.ios;

import com.perfecto.reportium.client.ReportiumClient;
import com.perfecto.reportium.client.ReportiumClientFactory;
import com.perfecto.reportium.model.Job;
import com.perfecto.reportium.model.PerfectoExecutionContext;
import com.perfecto.reportium.model.Project;
import com.perfecto.reportium.test.TestContext;
import com.perfecto.reportium.test.result.TestResultFactory;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.remote.DesiredCapabilities;


public class SimulatorsWebDemoTest {

    public static ReportiumClient reportiumClient;
    protected static IOSDriver<IOSElement> driver;

    String expectedPageTitle = "My Store";

    private static By ADD_TO_CART = By.xpath("//*[@id=\"homefeatured\"]//*[@class=\"ajax_block_product col-xs-12 col-sm-4 col-md-3 first-in-line first-item-of-tablet-line first-item-of-mobile-line\"]/div[1]/div[2]/div[2]/a[1]/span[1]");
    private static By CHECKOUT = By.xpath("//*[@class=\"btn btn-default button button-medium\"]");
    private static By CART = By.xpath("//*[text()=\"Cart\"]");
    private static By CHECK_OUT = By.xpath("//*[@id=\"button_order_cart\"]");

    public static void beforeClass() throws UnknownHostException, MalformedURLException {

        DesiredCapabilities capabilities = new DesiredCapabilities();

        String host = "<your_cloud_URL>";
        capabilities.setCapability("securityToken", "<your_token>");

        capabilities.setCapability("deviceName", "iPhone 11");
        capabilities.setCapability("useVirtualDevice", true);

        capabilities.setCapability("automationName", "Appium");
        capabilities.setCapability("browserName", "safari");

        driver = new IOSDriver(new URL("https://" + host + "/nexperience/perfectomobile/wd/hub"), capabilities);

        PerfectoExecutionContext perfectoExecutionContext = new PerfectoExecutionContext.PerfectoExecutionContextBuilder()
                .withProject(new Project("Simulators", "1.0"))
                .withJob(new Job("IOS tests simulators", 45).withBranch("branch-name"))
        reportiumClient = new ReportiumClientFactory().createPerfectoReportiumClient(perfectoExecutionContext);

    public void SimulatorWebDemoTest() throws InterruptedException {

            reportiumClient.testStart("Simulators Web 'Demo' test", new TestContext("simulatorsWeb"));

            System.out.println("************** START TEST *********************");

            reportiumClient.stepStart("Open '' url");

            reportiumClient.stepStart("Get url Title");
            String actualPageTitle = driver.getTitle();
            System.out.println("Page Title: " + actualPageTitle);
            Assert.assertEquals(expectedPageTitle, actualPageTitle);

            reportiumClient.stepStart("Clicking on 'Add to cart' button");
            System.out.println("Clicking on 'Add to cart' button");

            reportiumClient.stepStart("Get Screenshot");
            System.out.println("Get Screenshot");


            reportiumClient.stepStart("Clicking on 'Proceed to checkout' button");
            System.out.println("Clicking on 'Proceed to checkout' button");


            reportiumClient.stepStart("Clicking on 'Cart' button");
            System.out.println("Clicking on 'Cart' button");


            reportiumClient.stepStart("Clicking on 'Check Out' button");
            System.out.println("Clicking on 'Check Out' button");

            System.out.println("************** END TEST *********************");



        public static void afterClass () {

           String reportURL = reportiumClient.getReportUrl();
           System.out.println("Report URL - " + reportURL);

            if (driver != null) {



1 | Configure and run your tests

This step walks you through adding the required capabilities to your existing Appium test scripts against a virtual mobile device. For comprehensive information on how to make Appium test scripts work with Perfecto, including adding dependencies and integrating with Perfecto Smart Reporting, see Appium.

Note: Before running your script, it is good practice to use the Get Licensee Information by Type | Simulators API to check if a free simulator license is available. This step prevents script failures.

To configure and run your tests:

  1. Open an existing test script in the IDE of your choice. 
    The following sample code snippet is not yet configured to run in Perfecto. It opens an app (Safari) on a mobile platform (iOS) of a specific version (13.3). The device name is specific (iPhone X).

    Pure Appium script not running on Perfecto
    public static void main(String[] args) throws MalformedURLException, IOException {
        System.out.println("Run started");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("browserName", "Safari");
        capabilities.setCapability("deviceName", "iPhone X");
        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability("platformVersion", "13.3");
        IOSDriver driver = new IOSDriver(new URL(""), capabilities);
        System.out.println("Run ended");
  2. Configure the script to run in Perfecto by following the steps in the Appium section. In particular, you need to add dependencies, provide the security token and URL required to connect to the Perfecto cloud, and create an instance of the reporting client to integrate with Perfecto Smart Reporting.

  3. To run the test on a virtual device, add the capability useVirtualDevice and set it to true. The script should now look similar to the following. For more information on the individual capabilities, see Supported capabilities for virtual mobile devices and Supported Appium capabilities.

    Appium script running on Perfecto against a virtual device
    public static void main(String[] args) throws MalformedURLException, IOException {
            System.out.println("Run started");
            String cloudName = System.getProperty("cloudName");//Line added
    		String securityToken = System.getProperty("securityToken");//Line added
            DesiredCapabilities capabilities = new DesiredCapabilities(browserName, "", Platform.ANY);
            capabilities.setCapability("browserName", "Safari");
            capabilities.setCapability("deviceName", "iPhone X");
            capabilities.setCapability("platformName", "iOS");
            capabilities.setCapability("platformVersion", "13.3");
    		capabilities.setCapability("securityToken", securityToken);//Line added
            capabilities.setCapability("useVirtualDevice", true);//Line added
    		IOSDriver driver = new IOSDriver(new URL("https://" + cloudName + "/nexperience/perfectomobile/wd/hub"), capabilities);//Line modified
            System.out.println("Run ended");

    Note: To install the application to be tested on the simulator, use the app capability. The application specified by this capability is installed and launched automatically at the beginning of the script. If you need to install more than one app, use the app capability for the main application and the otherApps capability for additional apps. For more information, see Supported Appium capabilities and the Appium information on General Capabilities.

  4. Save your test.
  5. To avoid script failure, check if a simulator license is available via the Get License Information by Type API. 
  6. If a license is available, run your script.

2 | View execution results

This section describes how to view and analyze the results of your test executions in Perfecto.

To view execution results:

  1. When your test execution has finished, go to your Perfecto cloud instance and click Analyze Reports to open the Test Analysis view.
  2. In the Report Library, in the right pane, under Filter, select Platform type > Mobile simulator.

    If the right pane is not visible, click Configure View to open it.

    The report list refreshes to show only tests run on a simulator, as indicated by the simulator icon  in the Platform column.
    For more information on filtering, see Focus on what's important to you.

  3. Click the relevant test report.
  4. In the test view, do any of the following:
    • In the left pane, under Test Flow, review the test steps.
    • In the right pane, play the video.
    • At the top right, click the download button  to download the full report or the video.