# 6.1 Systematically test computational artifacts by considering all scenarios and using test cases 考虑使用场景、通过测试用例, 来系统性地测试产品

At any grade level, students should be able to compare results to intended outcomes. Young students should verify whether given criteria and constraints have been met. As students progress, they should test computational artifacts by considering potential errors, such as what will happen if a user enters invalid input. Eventually, testing should become a deliberate process that is more iterative, systematic, and proactive. Older students should be able to anticipate errors and use that knowledge to drive development. For example, students can test their program with inputs associated with all potential scenarios.

所有阶段的学生都应该能够比较“预期结果”和“实际结果”.

  1. 低阶段的学生应该能够验证, 给出的标准和约束条件是否得到满足
  2. 随着学生成长, 他们应该能够通过考虑潜在可能的错误来测试数字产品. 比如, 考虑用户输入不合法的字符会发生什么[1]
  3. 最终, 测试流程应该更加完善, 更具有迭代性、系统性和主动性
  4. 高阶段的学生应该能够预期到可能的错误, 并利用这样的知识来驱动自己的开发[2]. 比如说, 学生考虑所有潜在使用场景下的输入, 来测试自己的程序

  1. 比如要求用户输入手机号, 但是用户输入的是字母 ↩︎

  2. “测试驱动开发”, 可以参考《Python测试驱动开发》 (opens new window) ↩︎