Macaca-java for iOS Automated Environment setup
Basic principle Analysis: https://testerhome.com/topics/6608
First, Environment construction
1, install eclipse; -----Java Development Debugging Tool: Https://www.eclipse.org/downloads/PS:java Debugging Tools, can choose not to download according to their own circumstances.
2, install the node. JS Chinese network address: Http://nodejs.cn/node.js installation Method One: (1) Install Brew
/usr/bin/ruby-e "$ (Curl-fsslhttps://raw.githubusercontent.com/homebrew/install/master/install)" (2) Install node
Brew Install node (3) Verifies node installation
Verify node Installation: Node-v
Verifying NPM Installation: Npm-v node. js Installation Method II: (1) Install node
Visit the node. JS official website (https://nodejs.org/en/download/), download the installation package, install with one click; (2) Verifying node installation
Node-v npm-v 3, installing Xcode
Go to the Https://developer.apple.com/download/more/website to find the version of Xcode you want to download (Xcode installation requires 8.3 or higher) to download the installation.
PS: You can download Xcode on AppStore, but only the latest version is supported. 4. Install usbmuxd----Test IOS real computer via USB Channel
Brew Install Usbmuxd
5. Install Ios-webkit-debug-proxy----be installed when WebView is included in the test application
Brew Install Ios-webkit-debug-proxy 6, installing the Ios-deploy pack tool
NPM I ios-deploy-g 7, install Carthage
Brew Install Carthage
Ps:macaca XCTESTWD's code management uses Carthage
8, Installation Macaca
NPM i-g macaca-cli----Macaca command set
NPM i-g macaca-ios----Macaca-ios Automation driver
Macaca doctor----Check Macaca environment 8, installation Inspector
NPM I App-inspector-g
PS: Uninstall command: NPM Uninstall app-inspector-g 9, install Maven
Brew install maven 10, download iOS Automation framework Code
Download the iOS Automation framework code on SVN, path: Https://******/product/qa-platform/automation/iosmacaca/ios_a utomation/;
Enter the project catalogue;
Installation Engineering Dependency Library: Mvn-s settings.xml clean install-dskiptests
If the download depends on the process of error, it may be due to the mvn-s command is not effective, it is recommended that the root of the settings.xml in the configuration to the local Maven directory in Settings.xml
Local directory:/usr/local/cellar/maven/3.3.9/libexec/conf
The ps:eclipse with Maven is not described here, and will be added to this document if subsequent requirements are available. 11. XCTESTWD Configuration
Macaca webdriver exist two, one for app-inspector debugging needs, one for iOS automation needs, the path is:/usr/local/lib/node_modules/app-inspector/node_ Modules/xctestwd/xctestwd/xctestwd.xcodeproj
----App-inspector boot needs to be configured
/usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/xctestwd/xctestwd.xcodeproj----iOS automation needs to be configured
Macaca the two webdriver configuration is the same, the following will mainly take Macaca-ios as an example to describe the configuration: (1) Installation certificate, certificate: https://*******/iqiyitest/product/qa-platform/ automation/iosmacaca/identifier/
IOS_AUTOMATION.P12 (certificate password: 123456); (2) Download Profile,profile:https://*******/product/qa-platform
/automation/iosmacaca/identifier/ios_automation.mobileprovision; (3) Use Xcode to open/usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/xctestwd/xctestwd.xcodeproj project files; (4) Configure XCTESTWD, select XCTESTWD target, configure sign in gerneral and signing in build settings, see:
(5) configuration
Xctestwduitests, select Xctestwduiteststarget, configure sign in gerneral and signing in build settings, see:
(6) Open/usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/xctestwd/with Xcode Xctestwd.xcodeproj engineering documents, respectively, according to (4) (5) configuration.
PS: If the device is not available, the XCTESTWD cannot be installed on the device, please update the profile file yourself.
Second, the simulator operation
1. Start Macaca server Macaca server--verbose
2. Execute use case
New window into Macaca Java Demo project root command line execution: MVN test
Third, the use of Inspector
1. Start Macaca server Macaca server--verbose
2, obtain the device's UDID equipment Udid to obtain the way as follows:
(1) Simulator acquisition device Udid:xcrun SIMCTL list; (2) View simulator & connecting device udid:instruments-s; (3) Connecting device Udid:xcode View hardware->devices, manage devices.
3. Running Webdriver
Open Xcode, select Webdriveragentrunner target, and run the Webdriver on the connected device.
4, launch
App-inspector-u Your-device-id--verbose
5. Use the Inspector Element Finder browser to open: http://current_ip:5678 or http://localhost:5678
Four, the real machine operation
1. Connecting Equipment
Mac connects devices that can run test packages
2. Start Macaca server
Macaca server--verbose
3. Modify the Run configuration in Java code
The current run configuration takes the demo provided by Macaca as an example.
(1) Modify the Bootstrap/src/test/java/com/javademo/utils/config.java file in the project file to facilitate the real-computer operation, the following is the code snippet in the Config.java file:
Information about the iOS platform
Publicstaticfinalstring ios_platform_name = "IOS";
Publicstaticfinalstring ios_device_name = "Ranli1"; Connect the device's name
Publicstaticfinalstring Ios_app = rootpath + file.separator + "App/iqiyiphonevideo.app_2017-01-15_18-52.zip";
The path of the package, place the development package
Publicstaticfinalstring Ios_udid = "40911EF567D57FCFF5813D774FDEB108EAEFDE1B"; Udid publicstaticfinalstring ios_bundle_id = "************" of the connecting device; Bundle ID of the test installation package
(2) Modify the Bootstrap/src/test/java/com/javademo/cases/basetest.java in the project document File to facilitate the transfer of device information configured in the Config.java file to the server, the following is the code snippet for Basetest.java:
4. Execute use case
The new window enters the Macaca Java Demo Project root command line execution, the command is as follows:
All case runs: MVN test single case run: Mvntest-dtest=packagename.classname (mvntest-dtest=*****. cases.baseline.offline.function.Test_21674
1)
IOS Automation Environment Building--macaca