iOS Test Automation on Windows with Appium & TestProject!

The Challenge

One of the major obstacles with testing iOS apps is the need for iOS devices or Xcode to run the app on a Simulator.
Apple doesn’t support running Xcode (an Objective-C and Swift IDE) on any other operating system or hardware rather than macOS on Macs.
When it comes to Appium tests, Xcode is also required to build, sign, provision and run a special project that operates as a driver, executing the automation.

The Solution

TestProject framework enhances Appium driver and now enables you to run Appium tests on Windows operating system without the need for macOS.
The first thing you have to do is to get a TestProject account, no worries – it’s free!

Downloads

Then you need the TestProject Agent to be installed and running on your computer.
You will also require Apple’s iTunes application as it installs the required USB drivers for iOS devices.

Configuration

TestProject makes the driver signing and provisioning procedure easy.
After everything is installed, you have to configure your TestProject account with your iOS certificate and provisioning profile.
You can do this in the iOS section under account settings in the TestProject application website.

Team ID

The first thing you need to do is to provide your Apple’s Developer Program Team ID.
Team ID is a 10-character string that’s generated by Apple to uniquely identify your team.
You can find your Team ID here: https://developer.apple.com/account/#/membership

 

Team ID

Certificate Signing Request / Certificate

In order to allow us signing the driver with your certificate, you need to create a Certificate Signing Request (CSR).
On the iOS setting page, generate a new one and download a certificate signing request file.

Open https://developer.apple.com/account/ios/certificate/create to upload the CSR and download the generated certificate.

Upload the certificate to the appropriate section in the iOS setting page on the TestProject application website.

Mobile Provisioning Profile

The provisioning profile is used by Apple to list the eligible devices where the driver can be installed.

Navigate to https://developer.apple.com/account/ios/profile/limited/create and create an iOS App Development provisioning profile.
Continue the wizard and select the XC Wildcard when prompted for App ID.
Continue the wizard and select the certificate you have created earlier.
Select all devices you would like to allow being used for automated testing.
Give this profile a meaningful name.
Download the newly generated profile to your computer

Upload the profile to the appropriate section in the iOS setting page on the TestProject application website.

Usage

Now you have 2 options:

  1. Developing Appium tests for iOS by using TestProject SDK.
  2. Recording your iOS test from Windows using TestProject recording studio.

**In both options the tests will be running locally on your device by TestProject agent.

TestProject SDK

Download TestProject SDK.
Below is a short example of how to develop a simple test:

 

public class FullNameBuilderTest extends Test {

    @Override
    protected ExecutionResultType execute() throws Exception {

        // Get driver initialized by TestProject Agent
        IOSDriver<IOSElement> driver = this.getIOSDriver(IOSElement.class);

        // Find First name element and type 'John'
        IOSElement firstName = driver.findElement(By.id("firstName"));
        firstName.sendKeys("John");

        // Find Last name element and type 'Smith'
        IOSElement lastName = driver.findElement(By.id("lastName"));
        lastName.sendKeys("Smith");

        // Find Full Name element
        IOSElement fullName = driver.findElement(By.id("fullName"));

        // Verify that Full Name equals a concatenation of First and Last
        String fullNameText = fullName.getText();
        if (fullNameText.equals("John Smith")) {
            return ExecutionResultType.Passed;
        } else {
            return ExecutionResultType.Failed;
        }
    }
}

You can find more examples on TestProject GitHub.

Compile and upload the JAR to TestProject account.

TestProject_Create Test

Execute the Test.

Recording on Windows

You can record your iOS test in a live app from Windows using TestProject recording studio:

TestProject recording studio

 

Go ahead and try it out and share your experience in the comment section below  😉