Thursday, 3 December 2015

appium

1. use xcode to launch ios simulator
  • 'xcode' -> 'open developer tool' -> 'simulator', will run default simulator
  • now menu show simulator, 'file' to select other simulator if available

2. install ios app to simulator
  • find unsigned app in release, etc. iOS-Simulator-MyRNDemoApp.1.3.0-162.zip @https://github.com/saucelabs/my-demo-app-rn/releases
  • launch ios simulator
  • drag app to simulator,
  • or use cmd: xcrun simctl install BB6F3DD7-2BB6-428F-9673-562A23BE7480 ~/desktop/test.app

3. find device name, udid, platform version, bundle id for iso app
  • xcrun simctl list      //list available simulator with device name & udid, 'booted' means running
  • can find apple native app bundle id @https://support.apple.com/en-gb/guide/deployment/depece748c41/web
  • for custom app, find bundle id in its project, or ask developer

4. use appium inspector to inspect ios app
  • pre-requisite: run device/simulator, run appium server (cmd/ui)
  • specify 'desired capabilities'
  • can use 'bundleId' or 'app' in 'desired capability' to specify the app
  • when using 'bundleId', can find apple native app bundle id @https://support.apple.com/en-gb/guide/deployment/depece748c41/web
  • when using 'app', set 'appium:noReset' so that it will not reinstall app from filepath everytime
  • sample capability
{
  "appium:platformVersion": "13.3",
  "appium:deviceName": "iPhone 11 Pro Max",
  "appium:automationName": "XCUITest",
  "appium:bundleId": "com.apple.Preferences",
  "appium:platformName": "iOS"
}

5. use android studio to launch android simulator
  • 'more actions' -> 'sdk manager' to install sdk
  • 'more actions' -> 'virtual device manager' -> to create device
  • run device

6. install android app to android simulator
  • find .apk file in release
  • launch android simulator
  • drag apk to simulator

7. use appium inspector to inspect android app
  • similar to inspecting ios app
  • set 'ANDROID_HOME' in appium server configuration
  • sample capability
{
  "appium:appPackage": "com.saucelabs.mydemoapp.rn",
  "appium:deviceName": "emulator-5554",
  "appium:automationName": "UiAutomator2",
  "appium:appActivity": ".MainActivity",
  "appium:platformName": "android"
}

8. locator strategy
  • accessibilityId: content-desc (android), accessibility-id (ios)
  • className: class (android and ios)
  • id: id (android), name (ios)
  • name: name (android and ios)
  • xpath

5. get apk from phone
  • 'adb shell pm list packages' - list all packages
  • 'adb shell pm path com.example.someapp' - get full path in phone
  • 'adb pull /data/app/com.example.someapp-2.apk'

6. get AndroidManifest.xml
  •  apktool.bat d -f myapp.apk

7. cross platform - android/ios, mobile web/app
  • XCUITest - ios testing fw by apple for iOS 9.3 and above
  • UIAutomation - ios testing fw by apple for iOS 9.3 and lower
  • Espresso - android testing fw by google
  • UiAutomator/UiAutomator2 - android testing fw by google
  • appium use webdriver api, but it can have any of the above driver underneath, just like selenium, also use webdriver api, but can have chrome, firefox, safari driver

No comments:

Post a Comment