Skip to content

My First IOS Test

Krishnanand B edited this page May 10, 2017 · 3 revisions

Running tests on IOS platform is mostly similar to the tests running on Android Platform which you have learnt in My First Android Test.

Build Test Feed

Under resources folder create a new json file called OptimusIOS.json. You can copy below content in your newly created test feed.

{
  "executionDetails": {
    "appium_js_path": "/usr/local/bin/appium",
    "appium_node_path": "/usr/local/bin/node"
  },
  "testFeed": [
    {
      "belongsTo": "optimus",
      "runsOn": "simulator",
      "appDir": "app",
      "nativeApp":true,
      "optimusDesiredCapabilities": {
        "appiumServerCapabilities": {
          "app": "HelloOptimus.app",
          "platformName": "iOS",
          "deviceName":"iPhone 6",
          "platformVersion": "9.3",
          "automationName": "XCUITest"
        },
        "iOSOnlyCapabilities": {
          "launchTimeout": 300000
        }
      },
      "deviceState":{
        "captureVideo":true
      }
    }
  ]
}

Using this test feed you can run tests on IOS platform.

Run the below command

./gradlew runFragmentation -DtestFeed="helloOptimusIos" -Dtags=@helloOptimus

or

./gradlew runDistribution -DtestFeed="helloOptimusIos" -Dtags=@helloOptimus

In case you have a gradle distribution on local you can run below commands

gradle runFragmentation -DtestFeed="helloOptimusIos" -Dtags=@helloOptimus

or

gradle runDistribution -DtestFeed="helloOptimusIos" -Dtags=@helloOptimus

You will see that the HelloOptimus app is launched in IOS Simulator.