{"id":573,"date":"2013-05-25T16:57:29","date_gmt":"2013-05-25T08:57:29","guid":{"rendered":"http:\/\/www.yeetrack.com\/?p=573"},"modified":"2013-09-27T22:36:38","modified_gmt":"2013-09-27T14:36:38","slug":"robotium-%e6%b5%8b%e8%af%95android-apk%e5%ae%89%e8%a3%85%e5%8c%85","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=573","title":{"rendered":"Robotium \u6d4b\u8bd5Android apk\u5b89\u88c5\u5305"},"content":{"rendered":"<h3>\u4ecb\u7ecd<\/h3>\n<p>\u8981\u6d4b\u8bd5apk\u7a0b\u5e8f\u5fc5\u987b\u548c\u6211\u4eec\u7f16\u5199\u7684\u6d4b\u8bd5\u7a0b\u5e8f\u62e5\u6709\u76f8\u540c\u7684\u7b7e\u540d\uff08signature\uff09\u3002\u5982\u679c\u6ca1\u6709apk\u7a0b\u5e8f\u7684\u7b7e\u540d\u79d8\u94a5\uff0c\u5c31\u8981\u53bb\u9664apk\u7a0b\u5e8f\u7684\u7b7e\u540d\uff0c\u7136\u540e\u518d\u4f7f\u7528\u81ea\u5df1\u7684key\u5bf9\u5176\u7b7e\u540d(\u8fd9\u4e00\u6b65\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528debug key\uff09\uff0c\u5df2\u7ecf\u6709\u73b0\u6210\u7684\u5de5\u5177\u53ef\u7528\uff0c\u4e0b\u8f7d\u5730\u5740<a href=\"http:\/\/www.troido.de\/re-sign.jar\" target=\"_blank\" rel=\"nofollow\">re-sign.jar<\/a>\uff0c\u8fd9\u4e2a\u5de5\u5177\u53ef\u4ee5\u53bb\u6389apk\u7a0b\u5e8f\u7684\u539f\u7b7e\u540d\uff0c\u7136\u540e\u4f7f\u7528\u6211\u4eec\u81ea\u5df1\u7684debug key\u5bf9\u5176\u7b7e\u540d\u3002<!--more--><\/p>\n<h3>\u8be6\u7ec6<\/h3>\n<p>\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u77e5\u9053apk\u7a0b\u5e8f\u7684\u5305\u540d\uff08package name\uff09\u548c\u542f\u52a8\u9875\u9762\u540d\u79f0\uff08launcher activity name\uff09\uff0c\u8fd9\u4e24\u4e2a\u540d\u79f0\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u7a0b\u5e8f\u542f\u52a8\u65f6\u7684\u65e5\u5fd7\uff08adb logcat\uff09\u6765\u83b7\u53d6\u3002\u7a0b\u5e8f\u65e5\u5fd7\u4f1a\u6253\u5370\u51fa\u5305\u540d\u548cactivity\u540d\u79f0\u3002 \u65e5\u5fd7\u683c\u5f0f\u7c7b\u4f3c\u4e8e\uff1a<code>Starting activity: Intent { act=android.intent.action.MAIN cat=android.intent.category.LAUNCHER? flg=0x10200000 cmp=com.example.android.notepad\/.NotesList<\/code>\u3002<\/p>\n<p>\u4e0a\u9762\u7684\u65e5\u5fd7\u8868\u660e\u7a0b\u5e8f\u5305\u540d\u4e3a\uff1a<code>com.example.android.notepad<\/code>\u3001\u542f\u52a8activity\u540d\u4e3a:<code>com.example.android.notepad.NotesList<\/code>\uff0c\u8fd9\u91cc\u7684activity name\u5c31\u662f\u4e0b\u9762\u4ee3\u7801\u4e2d\u7684<strong>LAUNCHER_ACTIVITY<em>FULL<\/em>CLASSNAME<\/strong>\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u6d4b\u8bd5\u4ee3\u7801\u7684\u4f8b\u5b50\uff1a<\/p>\n<pre><code>package com.yourcompany.yourtestname;\n\nimport com.jayway.android.robotium.solo.Solo;\n\nimport android.test.ActivityInstrumentationTestCase2;\n\n@SuppressWarnings(\"rawtypes\")\npublic class ReallyBlackboxTest extends ActivityInstrumentationTestCase2 {\n\n    private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = \"com.newsrob.DashboardListActivity\";\n\n    private static Class&lt;?&gt; launcherActivityClass;\n    static{\n            try {\n                    launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);\n            } catch (ClassNotFoundException e) {\n                    throw new RuntimeException(e);\n            }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public ReallyBlackboxTest() throws ClassNotFoundException {\n            super(launcherActivityClass);\n    }\n\n    private Solo solo;\n\n    @Override\n    protected void setUp() throws Exception {\n            solo = new Solo(getInstrumentation(), getActivity());\n    }\n\n    public void testCanOpenSettings(){\n            solo.pressMenuItem(0);\n    }\n\n    @Override\n    public void tearDown() throws Exception {\n            solo.finishOpenedActivities();\n\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ecb\u7ecd \u8981\u6d4b\u8bd5apk\u7a0b\u5e8f\u5fc5\u987b\u548c\u6211\u4eec\u7f16\u5199\u7684\u6d4b\u8bd5\u7a0b\u5e8f\u62e5\u6709\u76f8\u540c\u7684\u7b7e\u540d\uff08signature\uff09\u3002\u5982\u679c\u6ca1\u6709apk\u7a0b\u5e8f\u7684\u7b7e\u540d\u79d8\u94a5\uff0c\u5c31\u8981\u53bb\u9664apk\u7a0b\u5e8f\u7684\u7b7e\u540d\uff0c\u7136\u540e\u518d\u4f7f\u7528\u81ea\u5df1\u7684key\u5bf9\u5176\u7b7e\u540d(\u8fd9\u4e00\u6b65\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528deb&#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":[33],"tags":[8,7,5,16,42],"class_list":["post-573","post","type-post","status-publish","format-standard","hentry","category-coding","tag-java","tag-7","tag-5","tag-16","tag-42"],"views":4747,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/573","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=573"}],"version-history":[{"count":3,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions"}],"predecessor-version":[{"id":735,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions\/735"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}