中國大學MOOC Android 客戶端開發提效之頁面信息

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/a5/a528383c8708e024bd346de7cb55db3d.png","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"本文主要描述了怎麼樣提高一個客戶端開發排查和定位的效率,並且動手寫了一個小工具的實踐和思考,以及團隊中其他合作者能夠提高了定位問題效率,驗證功能是否準確的效率。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"作者","attrs":{}},{"type":"text","text":"/馬傑 中國大學 MOCC 團隊","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"編輯","attrs":{}},{"type":"text","text":"/劉振宇","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"一、前言","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"中國大學 MOOC 是由網易與高教社攜手推出的在線教育平臺,承接教育部國家精品開放課程任務,向大衆提供中國知名高校的 MOOC 課程。目前,無論是課程數量、質量還是社會影響力,中國大學 MOOC 都已成爲全球領先的中文慕課平臺。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在日常的 Android 開發中,我們經常會遇到以下的一些問題:測試、運營、產品同學跑過來說這個頁面出了問題,趕緊看下。這時候客戶端開發同學就需要趕緊定位到具體的某個頁面。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"據觀察,大部分的情況下對於一個突發頁面的問題定位,或者業務方想讓開發者確認這個頁面的業務邏輯的時候,客戶端開發者,往往需要花費比較長的時間去給業務方答覆。如果近期業務可能還能記得,但是客戶端的頁面比較多,想要快速定位到具體業務頁面,那麼就需要花更多的時間去找相關的頁面。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"所以本文的想法是怎麼","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong","attrs":{}}],"text":"快速的找到對應的頁面","attrs":{}},{"type":"text","text":",幫助開發","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong","attrs":{}}],"text":"快速的進入業務代碼","attrs":{}},{"type":"text","text":",快速的回覆業務方提出的問題。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"二、方案實施","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在探討方案的時候,我們需要對比目前有哪些方案,對比之後再選擇一種更加有效的方法。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"2.1 解決問題的常用方式","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在 Android 開發中解決上述提供的問題,常用的有以下 3 種方式:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"打開 Android studio,靠着源碼記憶,文案記憶去搜索;","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"使用 adb 命令來過濾當前的 activity;","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"cpp"},"content":[{"type":"text","text":"// windows\nadb shell dumpsys window windows | Select-String -Pattern 'mCurrentFocus|mFocusedApp|mLastOpeningApp|mObscuringWindow'\n \n// Mac\nadb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp|mLastOpeningApp'","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"全局搜索關鍵文案。","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"上面 3 種方式是能夠解決問題,但從","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong","attrs":{}}],"text":"時間效率","attrs":{}},{"type":"text","text":"上分析,可以估算一下每一種方式大概需要多長時間:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"第一種","attrs":{}},{"type":"text","text":",按照個人經驗,熟悉項目代碼的同學最快也要幾十秒左右,慢的話 10 幾分鐘;","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"第二種","attrs":{}},{"type":"text","text":",使用 adb 能夠幾秒就定位到頁面,但是需要記住命令,或者提前設置命令快捷方式;","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"第三種","attrs":{}},{"type":"text","text":",如果有很多相同文案,需要多搜索幾遍,時間也可能是10幾秒到1分鐘不等。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"所有上面幾種方式得出的時間效率就是幾秒到幾分鐘不等,而且基本都是需要代碼或者 adb 的開發工具,依賴於開發環境。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"既然需要花的時間也不少,那麼是不是應該做一個工具來提升更快的定位速度,提升定位效率呢?","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"2.2 更加高效的方法","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"其實思路很簡單,就是寫一個開發的SDK,用來實時關注當前的頁面信息。這個頁面信息主要包含如下的信息:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"當前 Activity 是哪個?","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"當前的 Fragment 是哪個?","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"當前頁面的參數傳遞,如:intent 中的各種參數是什麼?","attrs":{}}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong","attrs":{}}],"text":"效果圖如下:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/7a/7a3b85ab3e7e23bc4f10cd674b9e88f7.png","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"從上面信息就能夠很快的定位到當前的頁面,當一個頁面的深度到非常深的時候,這樣的小工具就特別好用:","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"最快速度只要幾秒","attrs":{}},{"type":"text","text":"就能快速定位到頁面,效率提升","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"快幾十倍不止","attrs":{}},{"type":"text","text":"。而且能夠當着測試和產品的面,能夠把當前關鍵的參數給他看,如:xxxId、 埋點信息等。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"2.3 主要實現原理","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"上面的小工具,主要的工作是","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong","attrs":{}}],"text":"獲得當前的Activity","attrs":{}},{"type":"text","text":"。獲得當前Activity的方式主要有以下幾種方式:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"通過 RunningTaskInfo的 topActivity。該方法在後續的一些版本已經被禁用;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"手寫代碼管理Activity。這個方法比較粗暴,維護比較麻煩;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"通過反射 ActivityThread獲得 currentActivityThread 從 mActivities 中查詢獲得;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"使用AccessibilityService 這個輔助功能,這個方法獲得信息比較少;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"通過 ActivityLifecycleCallback 監聽來獲得。","attrs":{}}]}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"經過對比,選擇使用","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"AccessibilityService","attrs":{}},{"type":"text","text":"和","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"ActivityLifecycleCallback","attrs":{}},{"type":"text","text":" 這2種方式去嘗試。以下就簡單的說下這2種方法的實現,並進行二者之間的對比以及最後做出的選擇。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2.3.1 ActivityLifecycleCallback 方式","attrs":{}}]},{"type":"codeblock","attrs":{"lang":"cpp"},"content":[{"type":"text","text":"private static Activity topActivity;\n @Override\npublic void onActivityResumed(Activity activity) {\n topActivity = activity;\n}","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"是不是很簡單?爲了避免內存泄漏,可以在 onDestroy 的時候把 topActivity 設置成 null。這種方式","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"簡單快速","attrs":{}},{"type":"text","text":",不需要申請權限。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2.3.2 AccessibilityService 方式","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"繼承 AccessibilityService","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"cpp"},"content":[{"type":"text","text":"@Override\n public void onAccessibilityEvent(AccessibilityEvent event) {\n Log.d(TAG, \"onAccessibilityEvent\");\n if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {\n if (event.getPackageName() != null && event.getClassName() != null) {\n ComponentName componentName = new ComponentName(\n event.getPackageName().toString(),\n event.getClassName().toString()\n );\n ActivityInfo activityInfo = tryGetActivity(componentName);\n boolean isActivity = activityInfo != null;\n if (isActivity) {\n Log.d(TAG, \"CurentActivity \" + componentName.flattenToShortString());\n Log.d(TAG, \"CurentActivity \" + event.getPackageName().toString());\n }\n }\n }\n }\nprivate ActivityInfo tryGetActivity(ComponentName componentName) {\n try {\n return getPackageManager().getActivityInfo(componentName, 0);\n } catch (PackageManager.NameNotFoundException e) {\n return null;\n }\n }","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"manifest 配置","attrs":{}}]}]}],"attrs":{}},{"type":"codeblock","attrs":{"lang":"cpp"},"content":[{"type":"text","text":"\n \n \n \n \n ","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"需要 res/xm/accessibilityservice.xml 文件","attrs":{}}]}]}],"attrs":{}},{"type":"codeblock","attrs":{"lang":"cpp"},"content":[{"type":"text","text":"\n\n","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"和 ActivityLifecycleCallback 相比,這種方式相對複雜點,但是也還是簡單的。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2.3.3 2種方式的對比","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"從","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"實現角度","attrs":{}},{"type":"text","text":"對比,使用 ActivityLifecycleCallback 比 AccessibilityService 更加簡單。但是 AccessibilityService 有個優勢就是可以不用集成到自己的 app 裏面,可以獨立運行,可以查看所有的當前頁面是屬於哪個 Activity,可以跨進程使用。使用 ActivityLifecycleCallback 必須要集成到自己的 app 中。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"實踐過程","attrs":{}},{"type":"text","text":"中,其實我們不只是想獲得當前的 Activity ,我們還想知道當前的 Activity 中有哪些當前的 fragment,當前的 Activity 從上一個 Activity 中獲得了哪些參數,當前的fragment 中有哪些參數等細節信息,那麼只能集成到 app 中去的時候纔會比較容易獲得,所以最後選擇了使用 ActivityLifecycleCallback 的方式。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2.3.4 頁面更詳細的信息","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"一般頁面上的信息開發,簡單一點的就是一個 Activity 然後簡單佈局,複雜一點的基本都是 Activity + (ViewPager)Adatper + fragment,有時候 fragment 裏面還會有 ViewPager 裝載着 fragment, 對於不熟悉代碼的人找對應的業務邏輯頁面和代碼,還是需要花費不少時間的。所以頁面信息 fragment 也很重要。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"cpp"},"content":[{"type":"text","text":"\ntopActivity.getIntent().getExtras();// 獲得 activity 的頁面參數\ntopActivity.getSupportFragmentManager().getFragments(); // 獲得 activity 一級中的 fragments\nfragment.getChildFragmentManager().getFragments();// 對應 fragment 中的 fragments\nfragment.getArguments() // 獲得 fragment的頁面參數","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"三、 提高效率舉例","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這個頁面信息採集,這裏列舉了幾個使用場景,來證明效率得到了提高:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"對於","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}},{"type":"strong","attrs":{}}],"text":"客戶端開發者","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":",能夠快速的定位到當前出錯的頁面,特別是剛來的開發,或者不熟悉這塊業務的,或者業務頁面深度比較深的時候;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}},{"type":"strong","attrs":{}}],"text":"頁面核心參數的確認","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"。比如詳情頁面需要一些 id","attrs":{}},{"type":"text","text":",","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"這些詳細參數就不需要客戶端同事打斷點的方式去獲取,運營和測試自己可以去查看;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"在","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}},{"type":"strong","attrs":{}}],"text":"精品課和雲課堂集成","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"的時候,能夠讓測試同學快速的區分哪個是精品課裏面的頁面,哪個是雲課堂裏面的頁面,這樣方便測試知道當前頁面是屬於哪個業務端的;(這個場景是網易內部融合項目)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}},{"type":"strong","attrs":{}}],"text":"頁面全鏈路參數傳遞驗證場景","attrs":{}},{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"。比如:首頁點擊需要傳遞轉化率的參數一直傳遞到下單頁面,平時都是開發自己驗證,有這個工具後,產品也能在提測後,從測試包上自己查看驗證。","attrs":{}}]}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"四、 頁面信息其他想法","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"關於頁面信息場景增強,以下幾種頁面信息方式,是認爲可以進行擴充的:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"可以獲得 RecyclerView 中的 adapter;(有很多佈局邏輯,放到了 adapter 裏面的 ViewHolder)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"webview 當前信息的監控;(前端同事調試)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"網絡看板的監控;(當前頁面的網絡請求信息)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"不連接電腦 Logcat 日誌查看看板;(不用連接電腦,獲得 adb 信息)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#000000","name":"black"}}],"text":"參考線,界面元素位置,對應元素的顏色。(UI 走查的驗證)","attrs":{}}]}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"以上的幾點,主要是按照自身 app 的情況去判斷是否需要實現,判斷哪些實現性價比比較高。目前已經實現的,基本都是個人認爲","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"性價比是比較高","attrs":{}},{"type":"text","text":"的東西。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"五、 總結","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"當我們遇見一個問題的時候,首先思考這個問題是不是自己比較難受的點,然後觀察其他人是否有類似的情況。這個問題常用的解決方案什麼?有沒有工具方法去替代?如果沒有,可以不可以用比較低的成本去製造一個工具,最後來提升自己的效率,這個工具如果能夠幫助其他人,那麼能效就更加好了。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"-END-","attrs":{}}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章