深拷贝链表,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}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章