深拷貝鏈表,python處理音頻信號和數字信號、vim教程、swift單元測試和UI測試 John 易筋 ARTS 打卡 Week 21

{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"1. Algorithm: 每週至少做一個 LeetCode 的算法題"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"筆者的文章:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://blog.csdn.net/zgpeace/article/details/109022101","title":""},"content":[{"type":"text","text":"算法:深拷貝鏈表,其中鏈表有個隨機指向的指針Copy List with Random Pointer"}]}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"題目"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://leetcode.com/problems/copy-list-with-random-pointer/","title":""},"content":[{"type":"text","text":"138. Copy List with Random Pointer"}]}]},{"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":"A linked list is given such that each node contains an additional random pointer which could point to any node in the list or 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":"Return a deep copy of the list."}]},{"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":"The Linked List is represented in the input/output as a list of n nodes. Each node is represented as a pair of [val, random_index] where:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"val: an integer representing Node.val"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"random_index: the index of the node (range from 0 to n-1) where random pointer points to, or null if it does not point to any node."}]}]}]},{"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":"Example 1:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c9/c95f48e0fe74bfb45ebfba4c7f6cf514.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":""},"content":[{"type":"text","text":"Input: head = [[7,null],[13,0],[11,4],[10,2],[1,0]]\nOutput: [[7,null],[13,0],[11,4],[10,2],[1,0]]"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Example 2:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/61/61b3c070e4bcaf2d429db6091cc7a0e2.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":""},"content":[{"type":"text","text":"Input: head = [[1,1],[2,1]]\nOutput: [[1,1],[2,1]]"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Example 3:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/23/230773a9b9b4651e248ba5c5c2d80a1e.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":""},"content":[{"type":"text","text":"Input: head = [[3,null],[3,0],[3,null]]\nOutput: [[3,null],[3,0],[3,null]]"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Example 4:"}]},{"type":"codeblock","attrs":{"lang":""},"content":[{"type":"text","text":"Input: head = []\nOutput: []"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Explanation: Given linked list is empty (null pointer), so return null."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"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":"Constraints:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"-10000 <= Node.val <= 10000"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Node.random is null or pointing to a node in the linked list."}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"The number of nodes will not exceed 1000."}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"思路分析"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"next,random都需要指向對象,那麼就需要一個字典,key爲對象,value爲深拷貝的新對象。兩次循環即可:"}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"第一次循環組裝字典,"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"第二次循環設置next,random。"}]}]}]},{"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":"返回結果爲"},{"type":"codeinline","content":[{"type":"text","text":"dict[head]"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"解法一:手動複製鏈表到字典裏面"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"py"},"content":[{"type":"text","text":" def copyRandomList(self, head: 'Node') -> 'Node':\n dict = {}\n m = n = head\n while m:\n dict[m] = Node(m.val)\n m = m.next\n while n:\n dict[n].next = dict.get(n.next)\n dict[n].random = dict.get(n.random)\n n = n.next\n\n return dict.get(head)"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"解法二:用系統方法先深拷貝整個鏈表"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"py"},"content":[{"type":"text","text":"import collections\ndef copyRandomListWithOneRound(self, head: 'Node') -> 'Node':\n dic = collections.defaultdict(lambda: Node(0))\n dic[None] = None\n n = head\n while n:\n dic[n].val = n.val\n dic[n].next = dic[n.next]\n dic[n].random = dic[n.random]\n n = n.next\n\n return dic[head]"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2. Review: 閱讀並點評至少一篇英文技術文章"}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"link","attrs":{"href":"https://pysdr.org/index.html","title":null},"content":[{"type":"text","text":"PySDR: A Guide to SDR and DSP using Python"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://pysdr.org/content/intro.html","title":""},"content":[{"type":"text","text":"https://pysdr.org/content/intro.html"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這是一篇介紹python處理音頻信號和數字信號的簡短教程。說的是如果不想看1000頁的教程,用這個教程入門是比較方便的。"}]},{"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"}],"text":"Software-Defined Radio (SDR):"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"A radio that uses software to perform signal-processing tasks that were traditionally performed by hardware"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"Digital Signal Processing (DSP):"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"The digital processing of signals, in our case RF signals"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"3. Tips: 學習至少一個技術技巧"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"筆者的文章:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":""}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://blog.csdn.net/zgpeace/article/details/108919648","title":""},"content":[{"type":"text","text":"翻譯:Vim從入門到精通 Mac OS"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":""}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"說明"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Vim是Mac隨附的免費且功能強大的文本編輯器。在本教程中,我將向您展示此文本編輯器的基礎知識。"}]},{"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":"Pycharm 開啓vim編輯器後,tab功能不起作用,其實是用"},{"type":"codeinline","content":[{"type":"text","text":">"}]},{"type":"text","text":" 來縮進。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"打開文件"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"您可以像任何命令行編輯器一樣在Vim中打開文件。"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c6/c64469f2e18e32975157ef9bca1aab48.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果要編輯的文件是life.md,請在“終端”窗口中鍵入:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"shell"},"content":[{"type":"text","text":"vim life.md"}]},{"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":"Vim將在該終端中打開並加載該文件。Vim是終端程序,而不是圖形系統程序。"}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"Vim模式的基礎"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Vim有四種模式:Normal,Insert,Visual和Command。每種模式都在程序狀態欄的左下方顯示其名稱。"}]},{"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":"當您啓動Vim時,它處於正常模式。您可以使用所有命令鍵來瀏覽文件並開始編輯。當您退出任何其他模式時,Vim會返回到普通模式。"}]},{"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":"Vim使用a,A,i,I,o和O命令處於插入模式。進入插入模式後,編輯器將保持該模式,直到您按Esc鍵。每按一次其他鍵將直接插入文件中當前光標所在的位置。"}]},{"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":"當您在正常模式下使用v,V和Ctrl-v命令時,就會出現可視模式。在可視模式下,您可以選擇文本。當您使用導航命令時,從可視模式的開始到退出可視模式的區域是選定的文本。"}]},{"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":"在正常模式下,只要使用:命令,就會進入命令模式。在命令模式下,您可以執行復雜的編輯功能,文件操作或外殼程序操作。命令模式是唯一一種在狀態行上不顯示任何內容的模式,但是輸入的命令將放置在狀態行下,並鍵入任何其他內容和光標。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"保存文件並關閉Vim"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在正常模式下,您可以鍵入ZZ保存所有內容並退出。您也可以使用:w!保存文件。。的:將你置於命令模式中,w ^將寫入文件,以及!強制操作寫沒有問題。或者,您可以鍵入:wq或:wq!。該q退出編輯器。您也可以使用:q!退出而不保存。"}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"基本光標運動"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在普通模式下,您可以在文件中四處移動並對文件進行特定的編輯。該^ h鍵將光標移動到左邊。該升鍵將光標移動到右側。所述Ĵ鍵將光標向下移動一行,而ķ鍵將光標上移一行。要移至下一個單詞,請使用w命令。上一個單詞命令是b。"}]},{"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":"如果要一次移動多個空格,單詞或行,請先鍵入數字,然後再輸入方向鍵。光標將沿該方向移動該次數。例如,如果鍵入10j,光標將向下移動10行。"}]},{"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":"通過使用命令模式,您可以將行號切換爲絕對或相對:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"絕對編號模式是正常的:每行按順序具有唯一編號。 "}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"相對編號模式顯示當前編輯行以外的行數。"}]}]}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/f9/f9a072b56dd127804d7e18e323427647.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"要使用絕對行編號,可以使用:set number命令。要不顯示行號,請使用:set nonumber命令。"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ea/eab17a34a6d6d68341d46d3f5b2086ca.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"要設置相對編號,請輸入:set relativenumber。要將其放回絕對編號,請輸入:set norelativenumber。"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ef/ef7bc6c7e64f149a96043943f014bed0.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"通過使用:set number和:set relativenumber設置兩種模式,Vim將顯示當前行以外的所有行的相對編號。當前的編輯行將顯示其絕對編號。"}]},{"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":"通過使用相對編號模式,您可以使用j或k命令快速查看要移動的行數。例如,要移至List所在的行,請按2j。"}]},{"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":"要移至行首,請使用0(即零)命令。要移至行尾,請使用$命令。的GG命令將所述光標移動到文件的開頭,而ģ命令將移動到文件的末尾。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"4. Share: 分享一篇有觀點和思考的技術文章"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"筆者寫的博客鏈接"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":""}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://blog.csdn.net/zgpeace/article/details/109058602","title":""},"content":[{"type":"text","text":"翻譯:iOS Swift單元測試 從入門到精通 Unit Test和UI測試 UITest"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"說明"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"編寫測試並不是魅力十足,但是由於測試可以防止您閃亮的應用程序變成臭蟲纏身的垃圾,所以這是必要的。如果您正在閱讀本教程,您已經知道應該爲代碼和UI編寫測試,但是可能不知道如何做。"}]},{"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":"您可能有一個正在運行的應用程序,但是您想測試爲擴展該應用程序所做的更改。也許您已經編寫了測試,但是不確定它們是否是正確的測試。或者,您已經開始開發新的應用程序,並想隨身進行測試。"}]},{"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":"本教程將向您展示:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如何使用Xcode的Test導航器來測試應用程序的模型和異步方法"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如何使用存根和模擬來僞造與庫或系統對象的交互"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如何測試UI和性能"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如何使用代碼覆蓋率工具"}]}]}]},{"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":"在此過程中,您將掌握測試忍者所使用的一些詞彙。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"找出要測試的內容"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在編寫任何測試之前,瞭解基礎知識很重要。您需要測試什麼?"}]},{"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":"如果您的目標是擴展現有應用程序,則應首先爲計劃更改的任何組件編寫測試。"}]},{"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":"通常,測試應涵蓋:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"核心功能:模型類和方法及其與控制器的交互"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最常見的UI工作流程"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"邊界條件"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Bug修復"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"測試最佳實踐"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"首字母縮寫詞FIRST描述了有效單元測試的一組簡明標準。這些標準是:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Fast快速:測試應該快速進行。"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Independent/Isolated獨立/隔離:測試不應相互共享狀態。"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Repeatable可重複:每次運行測試時,您都應獲得相同的結果。外部數據提供者或併發問題可能會導致間歇性故障。"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Self-validating自驗證:測試應完全自動化。輸出應該是“通過”或“失敗”,而不是依賴於程序員對日誌文件的解釋。"}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Timely及時:理想情況下,應該在編寫要測試的生產代碼之前編寫測試(測試驅動開發)。"}]}]}]},{"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":"遵循FIRST原則將使您的測試清晰且有用,而不是成爲您應用程序的障礙。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章