{"id":1035,"date":"2015-01-14T17:17:38","date_gmt":"2015-01-14T09:17:38","guid":{"rendered":"http:\/\/www.yeetrack.com\/?p=1035"},"modified":"2015-01-14T17:17:38","modified_gmt":"2015-01-14T09:17:38","slug":"robotium-%e7%94%a8%e4%be%8b%e5%88%86%e7%bb%84%e8%bf%90%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=1035","title":{"rendered":"Robotium \u7528\u4f8b\u5206\u7ec4\u8fd0\u884c"},"content":{"rendered":"<p>Robotium\u662f\u5f00\u6e90\u7684Android\u754c\u9762\u81ea\u52a8\u5316\u6d4b\u8bd5\u7684\u6846\u67b6\uff0c\u5b83\u5185\u90e8\u96c6\u6210\u4e86junit\uff0c\u4ee5test\u5f00\u5934\u7684\u65b9\u6cd5\uff0c\u4f1a\u81ea\u52a8\u8bc6\u522b\u6210\u6d4b\u8bd5\u7528\u4f8b\uff0c\u8fd9\u6837\u505a\u5e26\u6765\u5feb\u6377\u7684\u540c\u65f6\uff0c\u5374\u4e5f\u5e26\u6765\u4e86\u4e0d\u4fbf\u3002\u5982\u679c\u6211\u4eec\u8981\u5206\u529f\u80fd\u3001\u5206\u6a21\u5757\u7b49\uff0cRobotium\u4e0d\u652f\u6301\u81ea\u5b9a\u4e49\u7684testsuite\u3002\u5728\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u7528<code>adb shell am instrument<\/code>\u8fd9\u6761\u547d\u4ee4\u6765\u5b9e\u73b0\u5206\u7ec4\u3002<!--more--><\/p>\n<ul>\n<li>\u4e0d\u5206\u7ec4\uff0c\u5168\u90e8\u8fd0\u884c\n<pre><code>  adb shell am instrument -w com.example.test\/android.test.InstrumentationTestRunner\n<\/code><\/pre>\n<\/li>\n<li>\u4ee5\u7c7b\u8fdb\u884c\u5206\u7ec4\n<pre><code>  adb shell am instrument -w -e class  com.example.test.testA com.example.test\/android.test.InstrumentationTestRunner  \n<\/code><\/pre>\n<\/li>\n<li>\u4ee5\u65b9\u6cd5\u8fdb\u884c\u5206\u7ec4\n<pre><code>  adb shell am instrument -w -e class com.huawei.mao.test.testA\\#testadd4 com.huawei.mao.test\/android.test.InstrumentationTestRunner\n<\/code><\/pre>\n<\/li>\n<li>\u4ee5\u6ce8\u91ca\u5206\u7ec4\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u81ea\u5df1\u7684\u6ce8\u91ca\u63a5\u53e3\uff0c\u4e3a\u6211\u4eec\u7684\u6d4b\u8bd5case\u5206\u7c7b\u3002<\/p>\n<p>\u58f0\u660e\u6ce8\u91ca\u63a5\u53e3\uff1a<\/p>\n<pre><code>  @Target({ElementType.METHOD, ElementType.TYPE})\n  @Retention(RetentionPolicy.RUNTIME)\n  @Documented\n  public @interface CatagoryGroup {\n  }\n<\/code><\/pre>\n<p>\u5728\u6d4b\u8bd5case\u4e2d\u4f7f\u7528\u6ce8\u91ca\uff1a<\/p>\n<pre><code>  @CatagoryGroup\n  public void testSearchWhileTabSwitch()\n  {\n  ...\n  }\n<\/code><\/pre>\n<p>\u8fd0\u884c\u547d\u4ee4\uff1a<\/p>\n<pre><code>  adb shell am instrument -w -e annotation com.yeetrack.CatagoryGroup com.example.test\/android.test.InstrumentationTestRunner\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2>xml\u8fd0\u884c\u7ed3\u679c<\/h2>\n<p>robotium\u9ed8\u8ba4\u7684\u7684\u662f<code>android.test.InstrumentationTestRunner<\/code>,\u8fd9\u4e2arunner\u4e0d\u63d0\u4f9bxml\u7ed3\u679c\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>com.zutubi.android.junitreport.JUnitReportTestRunner<\/code>,\u8fd9\u4e2arunner\uff0ccase\u8fd0\u884c\u7ed3\u675f\u540e\uff0c\u4f1a\u628ajunit\u7684xml\u7ed3\u679c\u4fdd\u5b58\u5728\u624b\u673a\u7684<code>\/data\/data\/someapk\/files\/Junit-report.xml<\/code>\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Robotium\u662f\u5f00\u6e90\u7684Android\u754c\u9762\u81ea\u52a8\u5316\u6d4b\u8bd5\u7684\u6846\u67b6\uff0c\u5b83\u5185\u90e8\u96c6\u6210\u4e86junit\uff0c\u4ee5test\u5f00\u5934\u7684\u65b9\u6cd5\uff0c\u4f1a\u81ea\u52a8\u8bc6\u522b\u6210\u6d4b\u8bd5\u7528\u4f8b\uff0c\u8fd9\u6837\u505a\u5e26\u6765\u5feb\u6377\u7684\u540c\u65f6\uff0c\u5374\u4e5f\u5e26\u6765\u4e86\u4e0d\u4fbf\u3002\u5982\u679c\u6211\u4eec\u8981\u5206\u529f\u80fd\u3001\u5206\u6a21\u5757\u7b49\uff0cRob&#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":[43,8,7,5,16,42,41],"class_list":["post-1035","post","type-post","status-publish","format-standard","hentry","category-coding","tag-android","tag-java","tag-7","tag-5","tag-16","tag-42","tag-41"],"views":3255,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1035","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=1035"}],"version-history":[{"count":1,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1035\/revisions"}],"predecessor-version":[{"id":1036,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1035\/revisions\/1036"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}