表格选择与编辑的测试与调试
1. 表格新增行测试示例
1.1 测试需求描述
当在表格中创建新行时,期望添加新行后能立即对其进行编辑。可以用文字描述这些行为:
$ shoulddoc prefs-add-tests.rb
context "adding a row"
should "grow the table"
should "put the new row in the last position"
should "add a translator preference with default values"
should "NOT mark the new preference as the favorite"
should "edit initial cell of the new row"
should "edit first cell in row even if columns have been rearranged"
这些 should 语句都是单个测试,在编写测试时,能帮助发现编码中容易忽略的歧义。例如,在编写编辑新行初始单元格的测试时,会思考是选择行中的第一个单元格进行编辑,还是选择“显示名称”单元格。最终决定选择第一个单元格,因为从第一个单元格开始编辑,按 Tab 键可以轻松遍历整行。
1.2 测试文件结构
测试文件通常具有特定的结构,以 fenestra/table-two-buttons-start/test/prefs-win
超级会员免费看
订阅专栏 解锁全文
1892

被折叠的 条评论
为什么被折叠?



