给定需要测试的方法:
// Search the given value using the provided search options
// Return true if the searchValue was found; false otherwise
bool Search(string searchValue, bool useExactSearch, bool useIndexing)
我有六个重要的搜索值(其中一个包含标点符号,另一个包含重音字符,另一个包含换行符等),我需要使用每种可能的useExactSearch和useIndexing组合来验证这些值。这意味着有54个测试用例。
你该怎么做呢?你真的会写54个单元测试吗?如果是这样,你会如何命名它们?你是否只为最重要的情况编写测试?你是否编写一个单独的单元测试,循环遍历参数值和预期结果的表格?如果我只编写一个单元测试,当持续集成报告失败时,更难找到哪个测试用例出了问题。