知识卡片
测试名称说明情境和预期
名称应让读者知道什么对象在什么输入条件下应做什么,而非只加test前缀重复函数名。清楚命名能减少阅读细节的负担,也帮助失败报告直接指向行为要求。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 软件自动化测试
原书出处 · 1 处
- · 查看原书依据
A meaningful test name Structure of arrange, act, assert (AAA) Specific and holistic assertions To illustrate these ingredients, let’s take a look at a positive and a negative example of a test. We’ll show more sophisticated tests in the next section, but for now a simple example will help us focus on the characteristics of a good test: # good example def test_convert_keys_to_snake_case_for_keys_with_spaces_or_punctuation(): # arrange
参考来源
- 位置:《Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)》第05章《软件自动化测试》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)/_epub-src/OEBPS/ch05.html)
- 结论依据:摘录中关于测试名称说明情境和预期的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:A meaningful test name Structure of arrange, act, assert (AAA) Specific and holistic assertions To illustrate these ingredients, let’s take a look at a positive and a negative example of a test. We’ll show more sophisticated tests in the next section, but for now a simple example will help us focus on the characteristics of a good test: # good example def test_convert_keys_to_snake_case_for_keys_with_spaces_or_punctuation(): # arrange