天天看点

IOS App自动化测试环境配置 - Selenium2.0+Appium

(注:项目是HP的,客户在美国,配置文档是给客户看的,所以用的E文,也懒得翻译了,见谅)

Test Environment

Mac and IOS environment

Mac mini: OS X 10.10.3

IOS devices: iPhone 5S 8.0

Software environment

JDK 1.8.25

XCode 6.3

Appium 1.3.7

HP ePrint IOS App 5.7.0.181

Apple developer accountrequirement

IOS Develop Permission. $99 per year.

Xcode Account Setup

Create a developer account onApple web site, and then login Xcode with the account.

Xcode -> Preferences -> Accounts -> Click ‘+’ toadd a new account -> Add the developer account.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Apple Developer Certificates

IOS App自动化测试环境配置 - Selenium2.0+Appium
IOS App自动化测试环境配置 - Selenium2.0+Appium

Download the certificates and save it into local disk. It’scertSigningRequest type file.

Create App ID.

Input any string in App ID Description failed, select “WildcardApp ID”, input “com.hp.*” in bund ID field, and then click Continue save it.

The App ID means a project name, so the created App IDshould matches the tested iOS app bundle ID, but we cannot create the explicitApp ID, such as ePrint “com.hp.com.HPePrintHome-n-Biz”, So we need create awildcard App ID, such as “com.hp.*”, it means the App ID works for all the iOSapp which bundle ID’s prefix is “com.hp.”.

IOS App自动化测试环境配置 - Selenium2.0+Appium

iOS device Setup

Select device tab and click “+” button, create device Nameand input the UUID and save it.

Get UUID from Xcode, open Xcode -> Window -> Devices-> select the connected device via USB, the Identifier is the UUID.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Generate ProvisioningProfiles.

Click “+” button to open “Add iOS Provisioning Profile”page. Select “iOS App development”and click “Continue”.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Select the created App ID just now and click “Continue”.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Select the created certificates just now and click “Continue”.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Select the new registered iOS device and click “Continue”

IOS App自动化测试环境配置 - Selenium2.0+Appium

Create a profile name and click “Generate” button.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Download the provisioning profile and save it into localdisk.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Re-sign IOS App

1) First extract HPePrint.app fromHPePrint.ipa

2) Generate “entitlements.plist”file and put it into the app folder.

The file contents should be, and open the file correct with Xcode.

<?xml version="1.0"encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC"-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plistversion="1.0">
<dict>
  <key>get-task-allow</key>
  <true/>
</dict>
</plist>
           
IOS App自动化测试环境配置 - Selenium2.0+Appium

3) Use the below command to re-sign the app.

Open a terminal and go to the app folder, execute below command.

IOS App自动化测试环境配置 - Selenium2.0+Appium

The parameter “iPhone Developer: XXXX” can be found inKeychain Access.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Appium and iOS Device Setup.

1) iOS setup

iOS device –> settings -> Developer -> Turn on “EnableUI Automation” option

IOS App自动化测试环境配置 - Selenium2.0+Appium

2) Install provisioning profileand re-signed app into iOS device.

Open Xcode -> Window -> devices -> click settingbutton below and open “Show Provisioning Profiles”

IOS App自动化测试环境配置 - Selenium2.0+Appium

Click “+” to add the provisioning profile into the iOSdevice.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Return device window and click “+” to select the re-signedapp and install it into device.

IOS App自动化测试环境配置 - Selenium2.0+Appium

3) Appium setup

IOS App自动化测试环境配置 - Selenium2.0+Appium

The parameter BundleID can be found in Xcode.

IOS App自动化测试环境配置 - Selenium2.0+Appium

Launch Appium Inspector

Open Appium -> click Start -> click Appium Inspector

Environment was ready if the Appium inspector launchedsuccessfully in Mac and the App launched successfully in iOS device.

IOS App自动化测试环境配置 - Selenium2.0+Appium