Create First Appium Test for IOS App

 

To create your first Appium test for an iOS device using Eclipse IDE on Windows, follow these steps:

Prerequisites

Even though you’re using Windows, testing iOS apps requires a macOS system to:

  • Install Xcode and iOS simulators

  • Run Appium server

  • Access iOS devices or simulators


So, either:

  • Use a real Mac, OR

  • Use a cloud device farm (example: BrowserStack, Sauce Labs)

  • You cannot run iOS tests from Windows directly without remote access to macOS.


Tools Required:

ToolPurpose
Java JDKRequired for Java development
Eclipse IDECode editor
Appium DesktopFor inspecting elements & running Appium server
Node.jsDependency for Appium
Appium Java ClientJava bindings for Appium
macOS with XcodeTo run iOS simulator/device
iOS .app or .ipa fileThe app under test


Sample App: Test App from Appium

You can use:
Appium’s sample: TestApp.app
GitHub: https://github.com/appium/sample-code


Project Setup in Eclipse

  1. Create a Maven Project in Eclipse

  2. Add the following dependencies to pom.xml:



<dependencies>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.10.0</version>
    </dependency>
</dependencies>




Java Test Script for iOS (Appium + TestNG):
Here's an example of testing a basic iOS calculator app or TestApp.app:


import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;

public class IOSAppTest {

    public static IOSDriver driver;

    public static void main(String[] args) {

        DesiredCapabilities caps = new DesiredCapabilities();

        // Mandatory capabilities
        caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
        caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "17.0"); // Change as per device
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 14"); // Simulator or real device
        caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        caps.setCapability(MobileCapabilityType.APP, "/Users/yourname/Downloads/TestApp.app"); // Path on mac

        // Optional
        caps.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);

        try {
            driver = new IOSDriver(new URL("http://localhost:4723/wd/hub"), caps);

            // Add basic actions here
            System.out.println("App launched successfully!");

            // Example action: Click a button (update with real locator)
            // driver.findElement(By.name("SomeButton")).click();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } finally {
            if (driver != null) {
                driver.quit();
            }
        }
    }
}


How to Run the Test

  • Start Appium Server on Mac (localhost:4723)
  • Ensure the simulator is running or real iOS device is connected
  • Run the test from Eclipse on your Windows PC
    • Eclipse sends test to macOS Appium server

  • Use SSH/Remote connection or CI tools (example: Jenkins + Mac agent) for triggering from Windows.


Next Steps

  • Replace TestApp.app with your real app .app or .ipa

  • Use Appium Inspector to get element locators

  • Use JUnit or TestNG for structure and assertions