{"id":1002,"date":"2014-10-29T15:56:54","date_gmt":"2014-10-29T07:56:54","guid":{"rendered":"http:\/\/www.yeetrack.com\/?p=1002"},"modified":"2014-10-29T15:58:48","modified_gmt":"2014-10-29T07:58:48","slug":"ios-monkey%e6%b5%8b%e8%af%95%e5%91%bd%e4%bb%a4%e8%a1%8c%e8%bf%90%e8%a1%8c%e6%97%a5%e5%bf%97%e6%94%b6%e9%9b%86","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=1002","title":{"rendered":"IOS monkey\u6d4b\u8bd5+\u547d\u4ee4\u884c\u8fd0\u884c+\u65e5\u5fd7\u6536\u96c6"},"content":{"rendered":"<h2>\u4f7f\u7528Xcode\u8fdb\u884cMonkey\u6d4b\u8bd5<\/h2>\n<p>\u5728\u6d4b\u8bd5app\u65f6\uff0c\u6211\u4eec\u9700\u8981\u6d4b\u8bd5\u4e00\u4e0bapp\u7684\u7a33\u5b9a\u6027\uff0cmonkey\u6d4b\u8bd5\u53ef\u4ee5\u57fa\u672c\u6ee1\u8db3\u6211\u4eec\u7684\u9700\u6c42\uff0cmonkey\u6d4b\u8bd5\u5b9e\u9645\u4e0a\u5c31\u662f\u5bf9app\u8fdb\u884c\u5404\u79cd\u6df7\u4e71\u64cd\u4f5c\uff0c\u7535\u8111\u968f\u673a\u4ea7\u751f\u64cd\u4f5c\u6307\u4ee4\uff0c\u7136\u540e\u53d1\u9001\u7ed9\u624b\u673a\uff0c\u8ba9\u624b\u673a\u53bb\u6267\u884c\uff0c\u8fd9\u6837\u6d4b\u8bd5\u6267\u884c\u4e00\u6bb5\u65f6\u95f4\uff08\u4e00\u822c\u662f\u51e0\u4e2a\u5c0f\u65f6\uff09\uff0c\u89c2\u5bdfapp\u662f\u5426\u6709crash\u6216\u8005\u5f02\u5e38\u65e5\u5fd7\u3002<\/p>\n<p>Android sdk\u4e2d\u5df2\u7ecf\u96c6\u6210monkey\u547d\u4ee4\uff0c<code>adb shell monkey<\/code>\u5f88\u65b9\u4fbf\u3002ios\u7684\u8bdd\uff0c\u9700\u8981\u6211\u4eec\u81ea\u5df1\u53bb\u5199\u811a\u672c\uff0c\u4e0d\u8fc7github\u5df2\u7ecf\u6709\u5f00\u6e90\u7684\uff0c<a href=\"https:\/\/github.com\/jonathanpenn\/ui-auto-monkey\">UI AutoMonkey<\/a>\uff0c\u62ff\u6765\u76f4\u63a5\u7528\u3002<!--more--><\/p>\n<ol>\n<li>\u4f7f\u7528Xcode\u6253\u5f00\u8981\u6d4b\u8bd5\u7684app<\/li>\n<li>\u542f\u52a8Instruments(Product-&gt;Profile),\u6216\u8005\u5feb\u6377\u952e\u2318I\u3002<\/li>\n<li>\u9009\u62e9\"Automation\",\u7136\u540e\u70b9\u51fb\"Profile\"<img decoding=\"async\" src=\"http:\/\/blog.manbolo.com\/2012\/04\/08\/template-chooser.png\" alt=\"image\" \/><\/li>\n<li>Instruments\u542f\u52a8\u540e\uff0c\u4f1a\u9ed8\u8ba4\u542f\u52a8\u5f55\u5236\u3002\u6211\u4eec\u70b9\u51fb\u7ea2\u8272\u6309\u94ae\uff08\u5feb\u6377\u952e\u2318R\uff09\uff0c\u628a\u5b83\u505c\u6389\u3002<img decoding=\"async\" src=\"http:\/\/blog.manbolo.com\/2012\/04\/08\/instruments-empty-600.png\" alt=\"image\" \/><\/li>\n<li>\u5728\u811a\u672c\u7ba1\u7406\u7684\u7a97\u53e3\uff0c\u65b0\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u70b9\u51fb\u201cAdd &gt; Create\u201d<img decoding=\"async\" src=\"http:\/\/blog.manbolo.com\/2012\/04\/08\/create-script.png\" alt=\"image\" \/><\/li>\n<li>\u7c98\u8d34\u8dd1monkey\u7528\u7684js\u4ee3\u7801\uff0c\u53ef\u4ee5\u624b\u52a8\u8c03\u6574\u4ee3\u7801\uff0c\u8bbe\u7f6e\u64cd\u4f5c\u7684\u95f4\u9694\u65f6\u95f4\uff0c\u4e8b\u4ef6\u603b\u91cf\uff0c\u4e8b\u4ef6\u6982\u7387\u3002\u4ee3\u7801\u5730\u5740:<a href=\"https:\/\/github.com\/jonathanpenn\/ui-auto-monkey\/blob\/master\/UIAutoMonkey.js\">https:\/\/github.com\/jonathanpenn\/ui-auto-monkey\/blob\/master\/UIAutoMonkey.js<\/a><img decoding=\"async\" src=\"http:\/\/blog.manbolo.com\/2012\/04\/08\/uiautomation-1-600.jpg\" alt=\"image\" \/><\/li>\n<li>\u91cd\u65b0\u8fd0\u884c\u811a\u672c\uff08\u4e0d\u7528\u4fdd\u5b58\uff09\uff0c\u5feb\u6377\u952e\u2318R,\u811a\u672c\u5c31\u4f1a\u88abXcode\u6267\u884c\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u63a7\u5236\u53f0\u770b\u5230\u65e5\u5fd7\u3002<img decoding=\"async\" src=\"http:\/\/blog.manbolo.com\/2012\/04\/08\/uiautomation-2-600.jpg\" alt=\"image\" \/><\/li>\n<\/ol>\n<h2>\u8131\u79bbXcode\uff0c\u547d\u4ee4\u884c\u6267\u884cinstruments<\/h2>\n<p>Instruments\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e0b\u6267\u884c\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u76f4\u63a5\u8c03\u7528js\u811a\u672c\u6267\u884c.<\/p>\n<pre><code>    instruments -w bb9265a3af***********1eb62d1c05274b1d -t \/Applications\/Xcode.app\/Contents\/Applications\/Instruments.app\/Contents\/PlugIns\/AutomationInstrument.xrplugin\/Contents\/Resources\/Automation.tracetemplate 5LDV722ABF.com.meilishuo.meilishuo -e UIASCRIPT \/Users\/apple\/work\/UIAutoMonkey.js UIARESULTSPATH \/Users\/apple\/Desktop\/  \n<\/code><\/pre>\n<ul>\n<li>-w udid \u5373ios\u8bbe\u5907\u552f\u4e00\u7684UDID\uff0c\u53ef\u4ee5\u4f7f\u7528iTunes\u83b7\u53d6\u3002<\/li>\n<li>-t \u6307\u5b9aInstrument\u8def\u5f84<\/li>\n<li>-e UIASCRIPT \u6307\u5b9a\u6211\u4eec\u7684js\u811a\u672c\u8def\u5f84<\/li>\n<li>UIARESULTSPATH \u6307\u5b9a\u7ed3\u679c\u4fdd\u5b58\u8def\u5f84<\/li>\n<\/ul>\n<h2>\u547d\u4ee4\u884c\u6293\u53d6iphone\u624b\u673a\u65e5\u5fd7<\/h2>\n<p>monkey\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u6293\u53d6\u6253\u5370\u7684log\uff0c\u4fdd\u5b58\u8d77\u6765\uff0cmonkey\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u8fdb\u884c\u5206\u6790\u3002monkey\u8fc7\u7a0b\u4e2d\uff0c\u65e5\u5fd7\u53ef\u80fd\u6bd4\u8f83\u591a\uff0c\u4f7f\u7528Xcode\u6765\u770b\uff0c\u5f88\u4e0d\u65b9\u4fbf\u3002<a href=\"https:\/\/github.com\/benvium\/libimobiledevice-macosx\/blob\/master\/README.md\">libimobiledevice-macosx<\/a>\u8fd9\u6b3e\u5de5\u5177\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728shell\u4e2d\u83b7\u53d6iphone\u7684log\u3002<\/p>\n<ol>\n<li>\u4e0b\u8f7d\u6e90\u7801 <code>git clone https:\/\/github.com\/benvium\/libimobiledevice-macosx.git<\/code><\/li>\n<li>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\n<pre><code> export DYLD_LIBRARY_PATH=\/your\/path\/here\/imobiledevice-macosx\/:$DYLD_LIBRARY_PATH\n PATH=${PATH}:\/your\/path\/here\/imobiledevice-macosx\/\n<\/code><\/pre>\n<\/li>\n<li>\u6267\u884c <code>source ~\/.bash_profile<\/code><\/li>\n<li>shell\u4e2d\u6267\u884c<code>idevicesyslog<\/code>\u5373\u53ef\u4ee5\u770b\u5230iphone\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u6253\u5370\u7684\u65e5\u5fd7\uff0c\u53ef\u4ee5\u4f7f\u7528grep\u8fc7\u6ee4\uff0c\u53ef\u4ee5\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528Xcode\u8fdb\u884cMonkey\u6d4b\u8bd5 \u5728\u6d4b\u8bd5app\u65f6\uff0c\u6211\u4eec\u9700\u8981\u6d4b\u8bd5\u4e00\u4e0bapp\u7684\u7a33\u5b9a\u6027\uff0cmonkey\u6d4b\u8bd5\u53ef\u4ee5\u57fa\u672c\u6ee1\u8db3\u6211\u4eec\u7684\u9700\u6c42\uff0cmonkey\u6d4b\u8bd5\u5b9e\u9645\u4e0a\u5c31\u662f\u5bf9app\u8fdb\u884c\u5404\u79cd\u6df7\u4e71\u64cd\u4f5c\uff0c\u7535\u8111\u968f\u673a\u4ea7\u751f\u64cd\u4f5c\u6307\u4ee4\uff0c\u7136&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[34],"tags":[44,9,52,42,41],"class_list":["post-1002","post","type-post","status-publish","format-standard","hentry","category-software","tag-ios","tag-javascript","tag-mac","tag-42","tag-41"],"views":7077,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1002"}],"version-history":[{"count":3,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1002\/revisions"}],"predecessor-version":[{"id":1005,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1002\/revisions\/1005"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}