@Gebitang
2015-01-13T14:11:14.000000Z
字数 10370
阅读 6242
iOS
Mac:10.8.4-10.9.2
iDevice:iOS5.0-7.0.6
注:由于需越狱,因此以下设备不支持:
Touch5(7.0.6),Touch4(5.0,5.1),Touch3(5.0,5.1),iPhone3GS(5.0,5.1),iPhone4(5.0,5.1),iPhone4s(5.1),iPhone5s(7.0.7)
下载并安装xCode(开发环境版本为5.0.2)(now latest version is 5.1,size: 2.18G, download from app store.)
在xCode > Preferences > Downloads > Components下,选择安装Command Line Tools
官网打开Terminal,输入:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
usbmuxd, the USB multiplexor daemon, is in charge of coordinating access to iPhone and iPod Touch services over USB. Synchronization and management applications for the iPhone and iPod Touch need this daemon to communicate with such devices concurrently.
usbmuxd
iTunes使用一种叫”usbmux”的东西与iphone通信, 这个东西提供了一个USB - TCP的转换服务.
这个服务在Mac端是由/System/Library/PrivateFrameworks/MobileDevice.framework/Resources/usbmuxd提供的, 当然, 开机自动启动.
它创建了一个Unix Domain Socket 在 /var/run/usbmuxd. usbmuxd服务程序监控iPhone在USB口上的连接, 当它监控到iPhone以用户模式连接到USB, (相对的是recovery模式), usbmuxd服务程序就会连接到这个/var/run/usbmuxd的TCP端口, 并开始成为一个USB - TCP 请求转发器那么,如果想编写个第三方程序与iphone进行通信,实现类似iTunes的功能, 你的程序可以通过usbmuxd! 建立一个TCP连接到/var/run/usbmuxd端口, 根据协议发送对应的请求包, usbmuxd服务会将请求转发到USB的iPhone上
brew install usbmuxd
安装依赖工具:
brew install libtool
brew install autoconf
brew install automake
安装libimobiledevice
./autogen.sh
make
sudo make install
Install libusbmuxd1.0.9: https://github.com/libimobiledevice/libusbmuxd/releases
Install libplist 1.11: https://github.com/libimobiledevice/libplist/releases
Must install latest version, otherwise make is not successful. Error: Undefined symbols for architecture x86_64:
may occurs, which is not unable to be solved for now.
附加信息
in order to install:
libxml >= 2.7.8
libplist
libusbmuxd
libimobiledevice
安装依赖包:
brew install libzip
安装ideviceinstaller,源码见附件ideviceinstaller.zip。官网
./autogen.sh
make
sudo make install
Q&A:
brew install libzip
提示:Warning: libzip-0.11.2 already installed, it's just not linked
执行: brew link libzip
提示:Error: Could not symlink share/man/man3/zip_unchange_archive.3
/usr/local/share/man/man3 is not writable.
需要添加man3到当前用户,如sudo chown -R 'cmmac' /usr/local/share/man/man3
然后再执行 brew link libzip
由于对iproxy有源码修改,所有需要进行手动编译生成,源码见附件usbmuxd-1.0.8.zip
安装iproxy:
mkdir build
cd build
cmake ..
make
sudo cp ./tools/iproxy /usr/local/bin/
---
iproxy 2222 22 04e48751ba246affdfb91c6e8bad9cc916948460
scp -P 2222 com.neusoft.DevStat_1.0-1_iphoneos-arm.deb root@127.0.0.1:/var/root/
ssh -p 2222 root@127.0.0.1
dpkg -i com.neusoft.DevStat_1.0-1_iphoneos-arm.deb
DevStat
,返回结果如:
Neu:~/myTemp root# DevStat
2014-06-25 13:21:22.588 DevStat[694:707] model=iPhone
2014-06-25 13:21:22.600 DevStat[694:707] systemName=iPhone OS
2014-06-25 13:21:22.605 DevStat[694:707] systemVersion=6.1.3
2014-06-25 13:21:22.609 DevStat[694:707] CPUFrequency=1GMHz
2014-06-25 13:21:22.613 DevStat[694:707] MemeorySize=504.95 M
2014-06-25 13:21:22.616 DevStat[694:707] TotalDiskSpace=13.69 G
2014-06-25 13:21:22.620 DevStat[694:707] FreeDiskSpace=11.16 G
2014-06-25 13:21:22.638 DevStat[694:707] ScreenPixel=(640 x 960)
2014-06-25 13:21:22.642 DevStat[694:707] ScreenResoultion=iPhone Retina 3.5-inch
安装ruby1.9.3(推荐使用rvm安装,教程)
curl -sSL https://get.rvm.io | bash -s stable
source ~/.bashrc
source ~/.bash_profile
安装rvm依赖项:
brew installer gcc46
注:
1,若gmp4下载不动,更改/usr/local/Library/Taps/homebrew-versions/gmp4.rb中url为’http://mirror.anl.gov/pub/gnu/gmp/gmp-4.3.2.tar.bz2’
2,若cloog-pp1015下载不动,更改/usr/local/Library/Taps/homebrew-versions/cloog-pp1015.rb中url为’ http://gcc.cybermirror.org/infrastructure/cloog-ppl-0.15.11.tar.gz’)
brew install libyaml
brew install readline
brew install libksba
注:
若下载不动,更改/usr/local/Library/Formula/libksba.rb中url为’ http://ftp.heanet.ie/mirrors/ftp.gnupg.org/gcrypt/libksba/libksba-1.3.0.tar.bz2’)
brew install openssl
rvm install 1.9.3
如果安装ruby1.9.3时提示:
Ruby 'ruby-1.9.3-p547' was built using clang - but it's not (fully) supported, expect errors.
WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.2 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
“No available formula for gcc46” while installing Ruby 1.9.3 on OS X with RVM:
Use:
rvm install 1.9.3 —with-gcc=clang
and it works.
然后安装以下gem
gem install rubyzip
gem install net-ssh
gem install run_loop
gem install plist
gem install --local autotest-0.2.5.gem(本地gem,见附件)
*使用本地安装,不能使用在线安装的方式 gem install autotest
*如果安装了多个autotest,可以使用 gem uninstall autotest
进行卸载,会自动提示卸载哪个版本。
安装log如下:
chinamobiledeiMac:~ cmmac$ gem install rubyzip
Fetching: rubyzip-1.1.3.gem (100%)
Successfully installed rubyzip-1.1.3
Installing ri documentation for rubyzip-1.1.3
1 gem installed
chinamobiledeiMac:~ cmmac$ gem install net-ssh
Fetching: net-ssh-2.9.1.gem (100%)
Successfully installed net-ssh-2.9.1
Installing ri documentation for net-ssh-2.9.1
1 gem installed
chinamobiledeiMac:~ cmmac$ gem install run_loop
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: run_loop-0.2.0.gem (100%)
Successfully installed run_loop-0.2.0
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for scripts/udidetect, skipping
Installing ri documentation for run_loop-0.2.0
Installing ri documentation for thor-0.19.1
2 gems installed
chinamobiledeiMac:~ cmmac$ gem install plist
Fetching: plist-3.1.0.gem (100%)
Successfully installed plist-3.1.0
Installing ri documentation for plist-3.1.0
1 gem installed
chinamobiledeiMac:~ cmmac$ gem install autotest
Fetching: ZenTest-4.10.0.gem (100%)
Successfully installed ZenTest-4.10.0
Fetching: autotest-4.4.6.gem (100%)
Successfully installed autotest-4.4.6
Installing ri documentation for ZenTest-4.10.0
Installing ri documentation for autotest-4.4.6
2 gems installed
chinamobiledeiMac:~ cmmac$ gem install net-scp
Fetching: net-scp-1.2.1.gem (100%)
Successfully installed net-scp-1.2.1
Installing ri documentation for net-scp-1.2.1
1 gem installed
chinamobiledeiMac:~ cmmac$
越狱(可使用windows安装PP助手或91助手进行越狱,参见越狱文档),进入Cydia选择“开发者”
用Cydia安装openssh
用Cydia安装top
用Cydia安装network-cmds
添加PP源(http://apt.25pp.com),并安装Appsync(请注意对应iOS版本)
依赖项:iproxy,net-ssh,net-scp
依赖项使用gem安装即可,如gem install net-scp
使用installdeb.rb:
使用方法:
-u 设备UDID
-d DEB文件路径
例:
./installdeb.rb -u ea9e02572eb2feeb191d2e5b851c05fe9b576dde -d ./clean.deb
*由于取log是根据本地mac时间,因此注意把移动设备时间和mac时间校准(无法精确校准的话,请把移动设备时间设置的快1分钟)
资料来源
Bruno is right on track. I've done extensive research and if you want to set variables that are available in all GUI apps, your only option is /etc/launchd.conf
Please note that environment.plist does not work for applications launched via Spotlight. This is documented by Steve Sexton here.
1) Open a terminal prompt
2) Type sudo vi /etc/launchd.conf (note: this file might not yet exist)
3) Put contents like the following into the file
# Set environment variables here so they are available globally to all apps
# (and Terminal), including those launched via Spotlight.
#
# After editing this file run the following command from the terminal to update
# environment variables globally without needing to reboot.
# NOTE: You will still need to restart the relevant application (including
# Terminal) to pick up the changes!
#
# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl
#
# See http://www.digitaledgesw.com/node/31
# and http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/
#
# Note that you must hardcode the paths below, don't use enviroment variables.
# You also need to surround multiple values in quotes, see MAVEN_OPTS example below.
#
setenv rvm_bin_path /Users/cmmac/.rvm/bin
setenv GEM_HOME /Users/cmmac/.rvm/gems/ruby-1.9.3-p547
setenv MY_RUBY_HOME /Users/cmmac/.rvm/rubies/ruby-1.9.3-p547
setenv rvm_path /Users/cmmac/.rvm
setenv PATH "/Users/cmmac/.rvm/gems/ruby-1.9.3-p547/bin:/Users/cmmac/.rvm/gems/ruby-1.9.3-p547@global/bin:/Users/cmmac/.rvm/rubies/ruby-1.9.3-p547/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/cmmac/.rvm/bin:/Users/cmmac/.rvm/gems/ruby-1.9.3-p547/gems/autotest-0.3.1/bin/"
4) Save your changes in VI and reboot your Mac. Or use the grep/xargs command show in the code comment above.
5) Prove that your variables are working by opening a Terminal window and typing export and you should see your new variables. These will also be available in IntelliJ and other GUI apps you launch via Spotlight.
配置Mac,用于可以进行自动重启,并执行TestAgent
等同与编辑sudo vi /etc/sudoers
文件
sudo visudo
将%admin ALL=(ALL) ALL
改为%admin ALL=(ALL) NOPASSWD: ALL
root ALL=(ALL) ALL
%admin ALL=(ALL) NOPASSWD: ALL
在系统偏好设置 -- 用户和群组 -- 登录选项中设置
如:
#!/bin/sh
java -jar testAgent.jar
保存,并加上可执行权限。
-- 在LaunchPad中选择Automator程序。
-- 文档类型选择 Automator程序
-- 资源库(Library)选择 文件和文件夹(Files & Folders)
-- 选择 获取指定的Finder项目(Get Specified Finder Items)
-- 选择添加,将shell脚本选中
-- 再选择打开Finder项目 (Open Finder Items);选择打开程序为终端Terminal
-- 保存为应用程序
在系统偏好设置 -- 用户和群组 -- 登录选项中设置
下载越狱开发插件
参考文档
clean、reachability项目模板:
choose a template for your new project -- Command-line Tool
功能测试录制工具
下载地址
下载MonkeyTalk Community对应版本。
可参看:PP助手iOS7完美越狱
或参考文档《越狱帮助文档.doc》
简明步骤如下:
0. 保证iPhone有稳定的wifi连接
1. 下载后,解压缩(PPGhost.zip)即可直接启动PPGhost.exe
2. 连接iPhone,识别后点击 开始越狱
3. PP越狱助手自动识别iOS设备与固件版本自动弹出越狱evasi0n7工具
4. 等待自动执行,期间iPhone会自动重启
5. 重启解开锁屏之后,点击iPhone端的evasi0n7图标
6. 等待越狱成功提示。
MonkeyTalk实际上是重新封装后的Eclipse,依赖于Java环境。因我们之前已经配置过Android的录制环境,所以这一步可以忽略。
只需要下载解压到本地即可使用。
可到官方网站下载Community版本
我们提供了已经下载好的win32版《monkeytalk-2.0.4-win32.zip》
请参考《MonkeyTalk说明文档.doc》。在线文档
简明步骤如下:
1. 启动MonkeyTalkIDE
2. 新建MonkeyTalkProject工程
3. 新建脚本
4. 启动手机端含有monkeyagent的程序(通常由开发人员提供,目前我们只要1.8.0版本的手机营业厅10086.ipa)
5. 在MonkeytalkIDE中wifi连接手机
6. 开始操作手机程序,进行录制
连接后控制台如果没有iOS agent的提示出现。
说明没有连接成功,此时录制按钮是不可用的状态。这种情况下:先从PC端执行ping 命令,如 ping 192.168.1.117(此IP为iPhone的ip地址,可在设置的网络详情里看到)。如果提示超时,或无法连接主机,说明连接异常,可以断开iPhone端的连接,再重新连接。通常这样处理之后,再次执行ping命令时即可连接正常。
录制首次启动的问题。
因为iPhone没有提供程序管理--清除数据的类似功能。只能通过删除和重新安装来实现首次启动的效果。
利用XY苹果助手(下载地址)完成本地程序的安装。启动该程序,连接手机后通过程序管理进行卸载和重新安装本地程序。具体可参看《MonkeyTalk说明文档.doc》最后的部分。
(提示没有安装AppSync)的解决方法:
通过 pp源安装 “ PP助手ipa补丁iOS7.X ”即可。
详情如下:
需要手机可以wifi联网:
1. 越狱后手机端有个Cydia程序。
2. 启动Cydia程序,选择“开发者”。(首次启动后会有提示选择)
3. 添加PP源。在 管理 -- 软件源 -- 编辑 -- 添加。 然后在 地址中输入:http://apt.25pp.com
4. 等待刷新完毕,回到Cydia后,进入25pp手机助手源
5. 安装 PP助手ipa补丁iOS7.X
*#PHONE#*
*#PASSWD#*
*#VERIFYCODE#*
Globals CaseName Define CaseName=脚本联动
脚本联动
为用户定义的该条脚本对应的测试用例