{"id":772,"date":"2023-02-26T21:45:20","date_gmt":"2023-02-26T13:45:20","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=772"},"modified":"2023-04-29T16:57:09","modified_gmt":"2023-04-29T08:57:09","slug":"android-test-android-unit-test","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/android-test-android-unit-test\/","title":{"rendered":"Android\u6d4b\u8bd5\uff083\uff09\uff1aAndroid\u5355\u5143\u6d4b\u8bd5"},"content":{"rendered":"<p>\u539f\u6587\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.com\/training\/testing\/unit-testing\/index.html\">https:\/\/developer.android.com\/training\/testing\/unit-testing\/index.html<\/a><\/p>\n<p>\u5355\u5143\u6d4b\u8bd5\u662f\u5e94\u7528\u7a0b\u5e8f\u6d4b\u8bd5\u7b56\u7565\u7684\u57fa\u672c\u6d4b\u8bd5\u3002\u901a\u8fc7\u9488\u5bf9\u60a8\u7684\u4ee3\u7801\u521b\u5efa\u548c\u8fd0\u884c\u5355\u5143\u6d4b\u8bd5\uff0c\u53ef\u4ee5\u8f7b\u677e\u9a8c\u8bc1\u5404\u4e2a\u5355\u5143\u7684\u903b\u8f91\u662f\u5426\u6b63\u786e\u3002\u5728\u6bcf\u6b21\u6784\u5efa\u4e4b\u540e\u8fd0\u884c\u5355\u5143\u6d4b\u8bd5\u53ef\u5feb\u901f\u6355\u83b7\u5e76\u4fee\u590d\u7531\u4ee3\u7801\u66f4\u6539\u5f15\u5165\u5230\u5e94\u7528\u7a0b\u5e8f\u7684\u8f6f\u4ef6\u56de\u5f52\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u5355\u5143\u6d4b\u8bd5\u901a\u5e38\u4ee5\u53ef\u91cd\u590d\u7684\u65b9\u5f0f\u5b9e\u73b0\u5c3d\u53ef\u80fd\u5c0f\u7684\u4ee3\u7801\u5355\u5143\uff08\u53ef\u4ee5\u662f\u65b9\u6cd5\uff0c\u7c7b\u6216\u7ec4\u4ef6\uff09\u7684\u529f\u80fd\u3002\u5f53\u9700\u8981\u9a8c\u8bc1\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7279\u5b9a\u4ee3\u7801\u7684\u903b\u8f91\u65f6\uff0c\u5e94\u8be5\u6784\u5efa\u5355\u5143\u6d4b\u8bd5\u3002\u4f8b\u5982\uff0c\u4f60\u521b\u5efa\u4e86\u4e00\u4e2a\u7c7b\uff0c\u5355\u5143\u6d4b\u8bd5\u53ef\u4ee5\u5e2e\u52a9\u68c0\u67e5\u8be5\u7c7b\u662f\u5426\u5904\u4e8e\u6b63\u786e\u7684\u72b6\u6001\u3002\u901a\u5e38\uff0c\u5355\u5143\u6d4b\u8bd5\u662f\u76f8\u5bf9\u72ec\u7acb\u7684\uff0c\u4f60\u7684\u6d4b\u8bd5\u53ea\u4f1a\u5f71\u54cd\u548c\u68c0\u67e5\u88ab\u6d4b\u8bd5\u5355\u5143\u7684\u53d8\u66f4\uff0cMock\u6846\u67b6\u53ef\u4ee5\u7528\u6765\u9694\u79bb\u4f60\u8981\u6d4b\u8bd5\u5355\u5143\u7684\u4f9d\u8d56\u3002<\/p>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u5355\u5143\u6d4b\u8bd5\u4e0d\u9002\u5408\u6d4b\u8bd5\u590d\u6742\u7684UI\u4ea4\u4e92\u4e8b\u4ef6\u3002\u76f8\u53cd\uff0c\u5e94\u8be5\u4f7f\u7528UI\u6d4b\u8bd5\u6846\u67b6\uff0c\u5982UI\u81ea\u52a8\u5316\u6d4b\u8bd5\u4e2d\u6240\u8ff0\u3002<\/p>\n<\/blockquote>\n<p>\u4e3a\u4e86\u6d4b\u8bd5Android\u5e94\u7528\u7a0b\u5e8f\uff0c\u901a\u5e38\u9700\u8981\u521b\u5efa\u8fd9\u4e9b\u7c7b\u578b\u7684\u5355\u5143\u6d4b\u8bd5\uff1a<\/p>\n<p>\u5982\u4f55\u6784\u5efa\u5728\u672c\u5730\u673a\u5668\u4e0a\u8fd0\u884c\u7684\u5355\u5143\u6d4b\u8bd5\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.com\/training\/testing\/unit-testing\/local-unit-tests.html\" title=\"\u521b\u5efa\u672c\u5730\u5355\u5143\u6d4b\u8bd5\">Building Local Unit Tests\uff08\u521b\u5efa\u672c\u5730\u5355\u5143\u6d4b\u8bd5\uff09<\/a><\/p>\n<p>\u5982\u4f55\u6784\u5efa\u5728Android\u8bbe\u5907\u6216\u6a21\u62df\u5668\u4e0a\u8fd0\u884c\u7684\u5355\u5143\u6d4b\u8bd5\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.com\/training\/testing\/unit-testing\/instrumented-unit-tests.html\" title=\"\u521b\u5efaInstrumented\u5355\u5143\u6d4b\u8bd5\">Building Instrumented Unit Tests\uff08\u521b\u5efaInstrumented\u5355\u5143\u6d4b\u8bd5\uff09<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\uff1ahttps:\/\/developer.android.com\/training\/testing\/unit- [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[222],"tags":[],"class_list":["post-772","post","type-post","status-publish","format-standard","hentry","category-android-test"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=772"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/772\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}