{"id":1558,"date":"2024-04-09T09:59:01","date_gmt":"2024-04-09T01:59:01","guid":{"rendered":"https:\/\/www.gyxwsjdxh.com\/?p=1558"},"modified":"2024-04-09T09:59:01","modified_gmt":"2024-04-09T01:59:01","slug":"android-%e6%89%8b%e6%9c%ba%e8%87%aa%e5%8a%a8%e5%8c%96%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7%e6%9c%89%e5%93%aa%e5%87%a0%e7%a7%8d%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.gyxwsjdxh.com\/1558.html","title":{"rendered":"Android \u624b\u673a\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\u6709\u54ea\u51e0\u79cd\uff1f"},"content":{"rendered":"\n

\n

\n

1\u3001Monkey<\/strong>\u662fAndroid SDK\u81ea\u5e26\u7684\u6d4b\u8bd5\u5de5\u5177<\/a><\/span>\uff0c\u5728\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u4f1a\u5411\u7cfb\u7edf\u53d1\u9001\u4f2a\u968f\u673a\u7684\u7528\u6237\u4e8b\u4ef6\u6d41<\/a><\/span>\uff0c\u5982\u6309\u952e\u8f93\u5165\u3001\u89e6\u6478\u5c4f\u8f93\u5165\u3001\u624b\u52bf\u8f93\u5165\u7b49)\uff0c\u5b9e\u73b0\u5bf9\u6b63\u5728\u5f00\u53d1\u7684\u5e94\u7528\u7a0b\u5e8f\u8fdb\u884c\u538b\u529b\u6d4b\u8bd5\uff0c\u4e5f\u6709\u65e5\u5fd7\u8f93\u51fa\u3002\u5b9e\u9645\u4e0a\u8be5\u5de5\u5177\u53ea\u80fd\u505a\u7a0b\u5e8f\u505a\u4e00\u4e9b\u538b\u529b\u6d4b\u8bd5<\/a><\/span>\uff0c\u7531\u4e8e\u6d4b\u8bd5\u4e8b\u4ef6\u548c\u6570\u636e\u90fd\u662f\u968f\u673a\u7684\uff0c\u4e0d\u80fd\u81ea\u5b9a\u4e49\uff0c\u6240\u4ee5\u6709\u5f88\u5927\u7684\u5c40\u9650\u6027\u3002<\/p>\n

2\u3001MonkeyRunner<\/strong>\u4e5f\u662fAndroid SDK\u63d0\u4f9b\u7684\u6d4b\u8bd5\u5de5\u5177\u3002\u4e25\u683c\u610f\u4e49\u4e0a\u6765\u8bf4MonkeyRunner\u5176\u5b9e\u662f\u4e00\u4e2aApi\u5de5\u5177\u5305<\/a><\/span>\uff0c\u6bd4Monkey\u5f3a\u5927\uff0c\u53ef\u4ee5\u7f16\u5199\u6d4b\u8bd5\u811a\u672c<\/a><\/span>\u6765\u81ea\u5b9a\u4e49\u6570\u636e\u3001\u4e8b\u4ef6\u3002\u7f3a\u70b9\u662f\u811a\u672c\u7528Python\u6765\u5199\uff0c\u5bf9\u6d4b\u8bd5\u4eba\u5458\u6765\u8bf4\u8981\u6c42\u8f83\u9ad8\uff0c\u6709\u6bd4\u8f83\u5927\u7684\u5b66\u4e60\u6210\u672c\u3002<\/p>\n

3\u3001Instrumentation<\/strong>\u662f\u65e9\u671fGoogle\u63d0\u4f9b\u7684Android\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\u7c7b\uff0c\u867d\u7136\u5728\u90a3\u65f6\u5019JUnit\u4e5f\u53ef\u4ee5\u5bf9Android\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4f46\u662fInstrumentation\u5141\u8bb8\u4f60\u5bf9\u5e94\u7528\u7a0b\u5e8f\u505a\u66f4\u4e3a\u590d\u6742\u7684\u6d4b\u8bd5\uff0c\u751a\u81f3\u662f\u6846\u67b6\u5c42\u9762\u7684\u3002\u901a\u8fc7Instrumentation\u4f60\u53ef\u4ee5\u6a21\u62df\u6309\u952e\u6309\u4e0b\u3001\u62ac\u8d77\u3001\u5c4f\u5e55\u70b9\u51fb\u3001\u6eda\u52a8\u7b49\u4e8b\u4ef6\u3002Instrumentation\u662f\u901a\u8fc7\u5c06\u4e3b\u7a0b\u5e8f\u548c\u6d4b\u8bd5\u7a0b\u5e8f<\/a><\/span>\u8fd0\u884c\u5728\u540c\u4e00\u4e2a\u8fdb\u7a0b\u6765\u5b9e\u73b0\u8fd9\u4e9b\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u628aInstrumentation\u770b\u6210\u4e00\u4e2a\u7c7b\u4f3cActivity\u6216\u8005Service\u5e76\u4e14\u4e0d\u5e26\u754c\u9762\u7684\u7ec4\u4ef6\uff0c\u5728\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u76d1\u63a7\u4f60\u7684\u4e3b\u7a0b\u5e8f\u3002\u7f3a\u70b9\u662f\u5bf9\u6d4b\u8bd5\u4eba\u5458\u6765\u8bf4\u7f16\u5199\u4ee3\u7801\u80fd\u529b\u8981\u6c42\u8f83\u9ad8\uff0c\u9700\u8981\u5bf9Android\u76f8\u5173\u77e5\u8bc6\u6709\u4e00\u5b9a\u4e86\u89e3\uff0c\u8fd8\u9700\u8981\u914d\u7f6eAndroidManifest.xml\u6587\u4ef6\uff0c\u4e0d\u80fd\u8de8\u591a\u4e2aApp\u3002<\/p>\n

4\u3001UiAutomator<\/strong>\u4e5f\u662fAndroid\u63d0\u4f9b\u7684\u81ea\u52a8\u5316\u6d4b\u8bd5\u6846\u67b6<\/a><\/span>\uff0c\u57fa\u672c\u4e0a\u652f\u6301\u6240\u6709\u7684Android\u4e8b\u4ef6\u64cd\u4f5c\uff0c\u5bf9\u6bd4Instrumentation\u5b83\u4e0d\u9700\u8981\u6d4b\u8bd5\u4eba\u5458\u4e86\u89e3\u4ee3\u7801\u5b9e\u73b0\u7ec6\u8282\uff08\u53ef\u4ee5\u7528UiAutomatorviewer\u6293\u53bbApp\u9875\u9762\u4e0a\u7684\u63a7\u4ef6\u5c5e\u6027\u800c\u4e0d\u770b\u6e90\u7801\uff09\u3002\u57fa\u4e8eJava\uff0c\u6d4b\u8bd5\u4ee3\u7801\u7ed3\u6784\u7b80\u5355\u3001\u7f16\u5199\u5bb9\u6613\u3001\u5b66\u4e60\u6210\u672c\uff0c\u4e00\u6b21\u7f16\u8bd1\uff0c\u6240\u6709\u8bbe\u5907\u6216\u6a21\u62df\u5668\u90fd\u80fd\u8fd0\u884c\u6d4b\u8bd5\uff0c\u80fd\u8de8App\uff08\u6bd4\u5982\uff1a\u5f88\u591aApp\u6709\u9009\u62e9\u76f8\u518c\u3001\u6253\u5f00\u76f8\u673a\u62cd\u7167\uff0c\u8fd9\u5c31\u662f\u8de8App\u6d4b\u8bd5<\/a><\/span>\uff09\u3002\u7f3a\u70b9\u662f\u53ea\u652f\u6301SDK 16\uff08Android 4.1\uff09\u53ca\u4ee5\u4e0a\uff0c\u4e0d\u652f\u6301Hybird App\u3001WebApp\u3002<\/p>\n

5\u3001Espresso<\/strong>\u662fGoogle\u7684\u5f00\u6e90\u81ea\u52a8\u5316\u6d4b\u8bd5\u6846\u67b6\u3002\u76f8\u5bf9\u4e8eRobotium\u548cUIAutomator\uff0c\u5b83\u7684\u7279\u70b9\u662f\u89c4\u6a21\u66f4\u5c0f\u3001\u66f4\u7b80\u6d01\uff0cAPI\u66f4\u52a0\u7cbe\u786e\uff0c\u7f16\u5199\u6d4b\u8bd5\u4ee3\u7801\u7b80\u5355\uff0c\u5bb9\u6613\u5feb\u901f\u4e0a\u624b\u3002\u56e0\u4e3a\u662f\u57fa\u4e8eInstrumentation\u7684\uff0c\u6240\u4ee5\u4e0d\u80fd\u8de8App\u3002\u914d\u5408Android Studio\u6765\u7f16\u5199\u6d4b\u8bd5\u7684\u7b80\u5355\u4f8b\u5b50<\/a><\/p>\n

6\u3001Selendroid\uff1a<\/strong>\u4e5f\u662f\u57fa\u4e8eInstrumentation\u7684\u6d4b\u8bd5\u6846\u67b6\uff0c\u53ef\u4ee5\u6d4b\u8bd5Native App\u3001Hybird App\u3001Web App\uff0c\u4f46\u662f\u7f51\u4e0a\u8d44\u6599\u8f83\u5c11\uff0c\u793e\u533a\u6d3b\u8dc3\u5ea6\u4e5f\u4e0d\u5927\u3002<\/p>\n

7\u3001Robotium<\/strong>\u4e5f\u662f\u57fa\u4e8eInstrumentation\u7684\u6d4b\u8bd5\u6846\u67b6\uff0c\u76ee\u524d\u56fd\u5185\u5916\u7528\u7684\u6bd4\u8f83\u591a\uff0c\u8d44\u6599\u6bd4\u8f83\u591a\uff0c\u793e\u533a\u4e5f\u6bd4\u8f83\u6d3b\u8dc3\u3002\u7f3a\u70b9\u662f\u5bf9\u6d4b\u8bd5\u4eba\u5458\u6765\u8bf4\u8981\u6709\u4e00\u5b9a\u7684Java\u57fa\u7840\uff0c\u4e86\u89e3Android\u57fa\u672c\u7ec4\u4ef6\uff0c\u4e0d\u80fd\u8de8App\u3002<\/p>\n

8\u3001Athrun<\/strong>\u662f\u6dd8\u5b9d\u51fa\u7684\u4e00\u4e2a\u79fb\u52a8\u6d4b\u8bd5\u6846\u67b6\/\u5e73\u53f0\uff0c\u540c\u65f6\u652f\u6301iOS\u548cAndroid\u3002Android\u90e8\u5206\u4e5f\u662f\u57fa\u4e8eInstrumentation\uff0c\u5728Android\u539f\u6709\u7684ActivityInstrumentationTestCase2\u7c7b\u57fa\u7840\u4e0a\u8fdb\u884c\u4e86\u6269\u5c55\uff0c\u63d0\u4f9b\u4e00\u6574\u5957\u9762\u5411\u5bf9\u8c61\u7684API\u3002\u8fd9\u91cc<\/a>\u6709\u8be6\u7ec6\u4ecb\u7ecd\u3002<\/p>\n

9\u3001Appium<\/strong>\u662f\u6700\u8fd1\u6bd4\u8f83\u70ed\u95e8\u7684\u6846\u67b6\uff0c\u793e\u533a\u4e5f\u5f88\u6d3b\u8dc3\u3002\u8fd9\u4e2a\u6846\u67b6\u5e94\u8be5\u662f\u662f\u529f\u80fd\u6700\u5f3a\u5927\u7684\uff0c<\/p>\n

\u5b83\u7684\u4f18\u70b9\uff1a<\/strong><\/p>\u5f00\u6e90\uff1b\u652f\u6301Native App\u3001Hybird App\u3001Web App\uff1b\u652f\u6301Android\u3001iOS\u3001Firefox OS\uff1bServer\u4e5f\u662f\u8de8\u5e73\u53f0\u7684\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528Mac OS X\u3001Windows\u6216\u8005Linux\uff1b

\u5b83\u7684\u54f2\u7406\u662f\uff1a<\/strong><\/p>\u7528Appium\u81ea\u52a8\u5316\u6d4b\u8bd5<\/a><\/span>\u4e0d\u9700\u8981\u91cd\u65b0\u7f16\u8bd1App\uff1b\u652f\u6301\u5f88\u591a\u8bed\u8a00\u6765\u7f16\u5199\u6d4b\u8bd5\u811a\u672c\uff0cJava\u3001Javascript\u3001PHP\u3001Python\u3001C#\u3001Ruby\u7b49\u4e3b\u6d41\u8bed\u8a00\uff1b\u4e0d\u9700\u8981\u4e3a\u4e86\u81ea\u52a8\u5316\u6d4b\u8bd5\u6765\u91cd\u9020\u8f6e\u5b50\uff0c\u56e0\u4e3a\u6269\u5c55\u4e86WebDriver\u3002\uff08WebDriver\u662f\u6d4b\u8bd5WebApps\u7684\u4e00\u79cd\u7b80\u5355\u3001\u5feb\u901f\u7684\u81ea\u52a8\u5316\u6d4b\u8bd5\u6846\u67b6\uff0c\u6240\u4ee5\u6709Web\u81ea\u52a8\u5316\u6d4b\u8bd5\u7ecf\u9a8c\u7684\u6d4b\u8bd5\u4eba\u5458\u53ef\u4ee5\u76f4\u63a5\u4e0a\u624b\uff09\uff1b\u79fb\u52a8\u7aef\u81ea\u52a8\u5316\u6d4b\u8bd5\u5e94\u8be5\u662f\u5f00\u6e90\u7684\uff1b

\u5b83\u7684\u8bbe\u8ba1\u7406\u5ff5\uff1a<\/strong><\/p>Client\/Server\u67b6\u6784\uff0c\u8fd0\u884c\u7684\u65f6\u5019Server\u7aef\u4f1a\u76d1\u542cClient\u7aef\u53d1\u8fc7\u6765\u7684\u547d\u4ee4\uff0c\u7ffb\u8bd1\u8fd9\u4e9b\u547d\u4ee4\u53d1\u9001\u7ed9\u79fb\u52a8\u8bbe\u5907\u6216\u6a21\u62df\u5668\uff0c\u7136\u540e\u79fb\u52a8\u8bbe\u5907\u6216\u6a21\u62df\u5668\u505a\u51fa\u54cd\u5e94\u7684\u53cd\u5e94\u3002\u6b63\u662f\u56e0\u4e3a\u8fd9\u79cd\u67b6\u6784\uff0c\u6240\u4ee5Client\u53ef\u4ee5\u4f7f\u7528Appium client libraries<\/a>\u591a\u79cd\u8bed\u8a00\u7684\u6d4b\u8bd5\u811a\u672c\uff0c\u800c\u4e14Server\u7aef\u5b8c\u5168\u53ef\u4ee5\u90e8\u7f72\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u751a\u81f3\u4e91\u670d\u52a1\u5668<\/a><\/span>\u3002Session\uff0c\u6bcf\u4e2aClient\u8fde\u63a5\u5230Server\u4ee5\u540e\u90fd\u4f1a\u6709\u4e00\u4e2aSession ID\uff0c\u800c\u4e14Client\u53d1\u9001\u547d\u4ee4\u5230Server\u7aef\u90fd\u9700\u8981\u8fd9\u4e2aSession ID\uff0c\u56e0\u4e3a\u8fd9\u4e2aseesion<\/a><\/span> id\u4ee3\u8868\u4e86\u4f60\u6240\u6253\u5f00\u7684\u6d4f\u89c8\u5668\u6216\u8005\u662f\u79fb\u52a8\u8bbe\u5907\u7684\u6a21\u62df\u5668\u3002\u6240\u4ee5\u4f60\u751a\u81f3\u53ef\u4ee5\u6253\u5f00N\u4e2aSession\uff0c\u540c\u65f6\u6d4b\u8bd5\u4e0d\u540c\u7684\u8bbe\u5907\u6216\u6a21\u62df\u5668\u3002Desired Capabilities\uff0c\u5176\u5b9e\u5c31\u662f\u4e00\u4e2a\u952e\u503c\u5bf9\uff0c\u8bbe\u7f6e\u4e00\u4e9b\u6d4b\u8bd5\u7684\u76f8\u5173\u4fe1\u606f\u6765\u544a\u8bc9Server\u7aef\uff0c\u6211\u4eec\u9700\u8981\u6d4b\u8bd5iOS\u3001\u8fd8\u662fAndroid\uff0c\u6216\u8005\u6362\u662fWebApp\u7b49\u4fe1\u606f\u3002Appium Server\u662fNode.js\u5199\u7684\uff0c\u6240\u4ee5\u53ef\u4ee5\u76f4\u63a5\u7528NPM\u6765\u8fdb\u884c\u5b89\u88c5\u3002Appium Clients\uff0cMac OS\u548cWin\u4e0b\u63d0\u4f9bGUI\uff0c\u4e0d\u9700\u8981\u88c5Node.js\uff0c\u65b9\u4fbf\u6d4b\u8bd5\u4eba\u5458\u64cd\u4f5c\u3002

\u76f8\u5173\u9650\u5236\uff1a<\/strong><\/p>\u5982\u679c\u4f60\u5728Windows\u4f7f\u7528Appium\uff0c\u4f60\u6ca1\u6cd5\u4f7f\u7528\u9884\u7f16\u8bd1<\/a><\/span>\u4e13\u7528\u4e8eOS X\u7684.app\u6587\u4ef6\uff0c\u56e0\u4e3aAppium\u4f9d\u8d56OS X\u4e13\u7528\u7684\u5e93\u6765\u652f\u6301iOS\u6d4b\u8bd5\uff0c\u6240\u4ee5\u5728Windows\u5e73\u53f0\u4f60\u4e0d\u80fd\u6d4b\u8bd5iOS Apps\u3002\u8fd9\u610f\u5473\u7740\u4f60\u53ea\u80fd\u901a\u8fc7\u5728Mac\u4e0a\u6765\u8fd0\u884ciOS\u6d4b\u8bd5\u3002

\u603b\u7ed3\uff1a<\/strong><\/p>\u5728iOS\u90e8\u5206\u662f\u5c01\u88c5\u4e86UIAutomation\uff1bAndroid 4.2\u4ee5\u4e0a\u662f\u7528UiAutomator\uff0cAndroid 2.3 ~ 4.1\u7528\u7684\u662f Instrumentation\uff0c\u4e5f\u5c31\u8bf4Appium\u540c\u65f6\u5c01\u88c5\u4e86UiAutomator\u548cInstrumentation\u3002\u6240\u4ee5Appium\u62e5\u6709\u4e86\u4ee5\u4e0a\u51e0\u5927\u6846\u67b6\u7684\u6240\u6709\u4f18\u70b9\uff1a\u8de8App\uff0c\u652f\u6301Native App\u3001Hybird App\u3001Web App\uff0c\u8fd8\u652f\u6301N\u79cd\u8bed\u8a00\u6765\u7f16\u5199\u4f60\u7684\u6d4b\u8bd5\u811a\u672c\u3002\n <\/span><\/div>\n\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"

1\u3001Monkey\u662fAndroid SDK\u81ea\u5e26\u7684\u6d4b\u8bd5\u5de5\u5177\uff0c\u5728\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u4f1a\u5411\u7cfb\u7edf\u53d1\u9001\u4f2a\u968f\u673a\u7684\u7528\u6237\u4e8b\u4ef6\u6d41\uff0c\u5982\u6309\u952e\u8f93\u5165\u3001\u89e6\u6478\u5c4f\u8f93\u5165\u3001\u624b\u52bf\u8f93\u5165\u7b49)\uff0c\u5b9e… <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[19],"tags":[],"class_list":["post-1558","post","type-post","status-publish","format-standard","hentry","category-news"],"_links":{"self":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts\/1558"}],"collection":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/comments?post=1558"}],"version-history":[{"count":1,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts\/1558\/revisions"}],"predecessor-version":[{"id":1559,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts\/1558\/revisions\/1559"}],"wp:attachment":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/media?parent=1558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/categories?post=1558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/tags?post=1558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}