Open
Description
Summary
本章小结
- Testing is a critical skill when writing software using Copilot.
- Closed-box and open-box testing are different approaches to ensuring the code is correct. In closed-box testing, we come up with test cases based on what we know about the problem; in open-box testing, we additionally examine the code itself.
- Doctest is a convenient way to test your code by adding test cases to the docstring description of a function.
- Creating artificial files is an effective way to test code that uses files.
- 在利用 Copilot 进行软件开发时,测试技能至关重要。
- 黑盒测试与白盒测试代表了确保代码准确性的两种不同策略。黑盒测试依据我们对问题的认识来设计测试案例;而在白盒测试中,我们会进一步审视代码本身。
- Doctest 提供了一种方便的方法,可以通过在函数的文档字符串说明中加入测试案例来对代码进行测试。
- 创造虚拟文件是测试涉及文件操作代码的一个高效策略。