# 覆盖阵列

覆盖阵列（covering array）是由规模为 v 的符号集构成的 N × k 矩阵，其中任取 t 列，在其各行之中，符号的每一种可能的 t 元组都至少出现一次。它是组合测试背后的数学对象：每一行成为一个测试用例，每一列成为被测系统的一个参数，从而用一个小规模的测试套件即可覆盖至多 t 个参数的全部交互。<sup>[1](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=917969)</sup><sup> • </sup><sup>[2](https://math.nist.gov/coveringarrays/coveringarray.html)</sup>

| 关键事实 | 说明 |
|---|---|
| 定义 | CA(N; t, k, v)：一个基于 v 个符号的 N × k 阵列，使得每个 N × t 子阵列都至少包含 v<sup>t</sup> 个 t 元组中的每一个一次<sup>[1](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=917969)</sup> |
| 参数 | t 为强度（所覆盖的交互层次），k 为列数（参数或输入个数），v 为每列的取值个数<sup>[2](https://math.nist.gov/coveringarrays/coveringarray.html)</sup> |
| 覆盖阵列数 | CAN(t, k, v) 是可能的最小行数；精确值仅在有限情形下已知，已发表的表格给出的是目前最好的上界<sup>[2](https://math.nist.gov/coveringarrays/coveringarray.html)</sup><sup> • </sup><sup>[3](https://www.sciencedirect.com/science/article/pii/S0096300319300864)</sup> |
| 与正交阵列的关系 | 覆盖阵列是正交阵列的推广：它只要求 t 元组被覆盖，而不要求其出现次数均衡<sup>[4](https://lematematiche.dmi.unict.it/index.php/lematematiche/article/view/166)</sup> |
| 测试集规模的增长 | 测试集的大小随 v<sup>t</sup>（每个参数的取值个数）呈指数增长，随参数个数 n 呈对数增长<sup>[5](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/faqs)</sup> |
| 压缩示例 | 1,000 个布尔变量的全部 1,329,336,000 种三路组合，由 ACTS 工具生成的一个 71 条测试的测试集覆盖<sup>[5](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/faqs)</sup> |
| 复杂度 | 构造最优覆盖阵列在一般情况下是 NP 难的，因此实际生成依赖贪心方法、启发式方法和代数方法<sup>[6](https://www.sciencedirect.com/science/article/pii/S0304397519306486)</sup> |

## 定义与记号

对于正整数 N、t、k 和 v，覆盖阵列 CA(N; t, k, v) 是集合 {0, 1, ..., v−1} 上的一个 N × k 矩阵，其性质是：每个 N × t 子阵列都至少一次覆盖集合 {0, 1, ..., v−1}<sup>t</sup> 中的每一个 t 元组。<sup>[1](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=917969)</sup> 参数 t 称为强度：当 t = 2 时，阵列覆盖任意两列上的每一对取值；当 t = 3 时覆盖每一个三元组；依此类推。列数 k 对应被测软件的输入个数，v 对应每个输入可取的设置个数。<sup>[2](https://math.nist.gov/coveringarrays/coveringarray.html)</sup>

核心的优化问题是：在 t、k、v 固定时，这样的阵列最小能有多小。这个最小值就是覆盖阵列数 CAN(t, k, v)。除 t = 2、v = 2 等特殊情形外，最优覆盖阵列的大小一般是未知的；美国国家标准与技术研究院等机构维护的参考表列出的是上界和已知最好的阵列。<sup>[2](https://math.nist.gov/coveringarrays/coveringarray.html)</sup> 精确值仍在通过有针对性的工作不断确定；例如，并置论证与穷举算法已确定 CAN(4, 13, 2) = 32、CAN(5, 8, 2) = 52、CAN(5, 9, 2) = 54、CAN(5, 14, 2) = 64、CAN(6, 15, 2) = 128 以及 CAN(7, 16, 2) = 256。<sup>[3](https://www.sciencedirect.com/science/article/pii/S0096300319300864)</sup>

## 与正交阵列及试验设计的关系

覆盖阵列最初是作为统计试验设计中所用正交阵列的一种放宽而出现的。20 世纪 60 至 70 年代，田口玄一（Genichi Taguchi）提倡把强度为二的正交阵列用作工业试验的模板；80 年代末 90 年代初，软件工程师开始用它们对软件以及软硬件系统做成对测试。这些阵列在生成软件测试套件方面的局限很快显现出来，而覆盖阵列放弃了“符号组合出现次数均衡”这一要求，被发现更适合这一用途。<sup>[7](https://www.sciencedirect.com/science/article/abs/pii/S0263224113000596)</sup><sup> • </sup><sup>[4](https://lematematiche.dmi.unict.it/index.php/lematematiche/article/view/166)</sup>

实际的差别在于规模：由于覆盖阵列只需保证每个 t 元组至少出现一次，它可以比相应的正交阵列小得多，同时仍覆盖与测试相关的每一种交互。<sup>[4](https://lematematiche.dmi.unict.it/index.php/lematematiche/article/view/166)</sup>

## 为什么 t 路覆盖有效：交互规则

覆盖阵列在测试中的依据来自对真实故障的经验研究。美国国家标准与技术研究院在 1999 至 2004 年间的一系列研究发现，大多数软件缺陷和故障由一两个参数的交互引起，涉及三个及以上参数的则逐渐减少；例如，一个二路交互故障可能需要"高度 = 0 且 体积 < 2.2"才能触发。<sup>[8](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/combinatorial-methods-in-testing/interactions-involved-in-software-failures)</sup>

这一发现被称为交互规则，它意味着：只要选取的 t 大于任何触发故障的交互中所含因子的最大数目，并且所有 t 路组合都被执行，穷尽测试就不必要了。多项研究发现，4 路至 6 路组合覆盖能检出穷尽测试所发现的全部故障，美国国家标准与技术研究院称之为“有效穷尽”测试。<sup>[8](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/combinatorial-methods-in-testing/interactions-involved-in-software-failures)</sup> 针对文档对象模型事件（Document Object Model Events）标准所做的一项对照比较，把覆盖等价类取值全部组合的 36,000 多个穷尽测试缩减了 20 倍以上，而故障检测水平相当。<sup>[9](https://www.nist.gov/publications/evaluation-fault-detection-effectiveness-combinatorial-and-exhaustive-selection)</sup>

## 构造与算法

由于构造最优覆盖阵列是 NP 难的，实际生成使用若干类方法。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0304397519306486)</sup>

**贪心方法与参数序贯法。** 参数序贯（In-Parameter-Order，IPO）策略一次添加一列来构建测试集，并追加行以覆盖尚未覆盖的交互。它的推广 IPOG 以及变体 IPOG-F 和 IPOG-F2 在水平扩展的实现方式上有所不同，构成了广泛使用的 ACTS 生成器的核心；其中 IPOG 是三者中的默认方法，也是最快的。<sup>[10](https://link.springer.com/article/10.1007/s42979-025-03937-y)</sup> 一项针对 295 个基准模型、对八种生成工具的比较评估发现，基于 IPO 的方法在速度与输出规模之间取得了良好平衡，并认定 CAgen、ACTS 和 APPTS 是综合得分领先的候选。<sup>[11](https://aisberg.unibg.it/handle/10446/274349)</sup>

**元启发式与搜索。** 禁忌搜索、遗传算法及相关元启发式方法被用于最小化阵列规模，通常作为对初始阵列的后优化；它们往往能产生较小的阵列，代价是生成时间。<sup>[11](https://aisberg.unibg.it/handle/10446/274349)</sup> 真实系统禁止某些取值组合，因此需要约束处理；各工具对此的支持程度不一，机制从禁用元组表示到 CSP 求解器不等。<sup>[10](https://link.springer.com/article/10.1007/s42979-025-03937-y)</sup><sup> • </sup><sup>[11](https://aisberg.unibg.it/handle/10446/274349)</sup>

**代数与递归构造。** 组合理论提供了直接构造与递归构造，包括基于有限域的方法和群构造；即使在所得阵列大于启发式阵列时，它们也能确立存在性与规模界。<sup>[4](https://lematematiche.dmi.unict.it/index.php/lematematiche/article/view/166)</sup><sup> • </sup><sup>[12](https://arxiv.org/abs/1708.07828)</sup>

## 变体

若干扩展把基本定义改造以适应实际需要：

- **混合水平覆盖阵列**允许水平数 v 在各列之间不同，以匹配参数取值个数各异的系统；受约束的版本还会排除不可行的因子—水平组合。<sup>[13](https://link.springer.com/chapter/10.1007/978-3-030-53288-8_5)</sup>
- **高指数覆盖阵列**要求每一种 t 路交互至少出现在 λ 个测试中而非一个；当交互效应强弱不一，或测试结果受测量误差影响时，这可提高测试效力。<sup>[14](https://asu.elsevierpure.com/en/publications/algorithmic-methods-for-covering-arrays-of-higher-index/)</sup>
- **可变强度覆盖阵列**对交互更强的若干选定列子集施加更高的强度。<sup>[15](https://www.slideserve.com/lahela/software-product-line-testing-part-iv-a-framework-for-variability-coverage)</sup>
- **序列覆盖阵列**，记作 SCA(N, S, t)，覆盖来自集合 S 的符号的每一种 t 路排列，其中这 t 个符号不必相邻；它们支持图形用户界面（GUI）和协议这类事件驱动系统——对这类系统普通覆盖阵列并不适用，因为标准构造算法是以任意顺序覆盖组合的。<sup>[16](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913805)</sup>
- **增量覆盖阵列**让测试人员可以先对不稳定的软件版本使用低强度阵列，再随预算允许提高强度。2025 年一项覆盖 17 个真实软件系统、共 84 个版本的比较发现，自顶向下（Top-down）策略——先生成较高强度的阵列，再从中抽取较低强度的集合——比传统的自底向上（Bottom-up）方法耗时更少、产生的阵列更小，同时改善了早期故障检测和行覆盖。<sup>[17](https://www.sciencedirect.com/science/article/pii/S0950584924002064)</sup>

## 工具与实践

ACTS 工具（Advanced Combinatorial Testing System，高级组合测试系统）由美国国家标准与技术研究院与得克萨斯大学阿灵顿分校（University of Texas, Arlington）合作开发，可生成 t 路覆盖阵列，支持约束和可变强度测试，运行于 Java 平台，属于公有领域；其 2013 年的基础论文在 ICST 2023 上获得最具影响力论文奖。<sup>[18](https://csrc.nist.gov/Projects/Automated-Combinatorial-Testing-for-Software/Downloadable-Tools)</sup><sup> • </sup><sup>[19](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software)</sup> 其他可免费获取的生成器包括 CAgen 和微软的 PICT，后者用贪心确定性启发式一次构建一个测试。<sup>[11](https://aisberg.unibg.it/handle/10446/274349)</sup><sup> • </sup><sup>[10](https://link.springer.com/article/10.1007/s42979-025-03937-y)</sup>

由于测试集规模随 v<sup>t</sup> 呈指数增长，而随参数个数仅呈对数增长，实践中建议把每个参数的取值个数控制在约 10 个以下，而数百乃至数千个参数仍然可控；已有针对 2,000 多个参数生成测试集的实例。<sup>[5](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/faqs)</sup> 美国国家标准与技术研究院的指南还把组合覆盖与结构覆盖联系起来：若 M<sub>t</sub> 为已覆盖的输入组合比例，B<sub>t</sub> 为触发某个代码分支的最低比例，则当 M<sub>t</sub> + B<sub>t</sub> > 1 时，100% 的分支覆盖是有保证的；因此，一个 M<sub>t</sub> = 100% 却未能接近全分支覆盖的覆盖阵列，说明输入模型应当修改。<sup>[5](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/faqs)</sup>

美国国家标准与技术研究院记录的应用案例包括奥多比（Adobe）、IBM、洛克希德·马丁（Lockheed Martin）、西门子（Siemens）和美国空军等机构的工作；该方法还超出软件领域，扩展到电路与网络设计，以及需要辨识因子间交互的筛选试验。<sup>[19](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software)</sup><sup> • </sup><sup>[4](https://lematematiche.dmi.unict.it/index.php/lematematiche/article/view/166)</sup><sup> • </sup><sup>[20](https://www.jmp.com/support/help/en/18.1/jmp/covering-arrays.shtml)</sup>

## References

1. [Covering array definition, NIST ACTS publication](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=917969)
2. [NIST Covering Array Tables: What is a covering array?](https://math.nist.gov/coveringarrays/coveringarray.html)
3. [New covering array numbers, Applied Mathematics and Computation](https://www.sciencedirect.com/science/article/pii/S0096300319300864)
4. [Charles J. Colbourn, Combinatorial aspects of covering arrays, Le Matematiche](https://lematematiche.dmi.unict.it/index.php/lematematiche/article/view/166)
5. [NIST Combinatorial Methods for Trust and Assurance: FAQs](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/faqs)
6. [A survey on the state of the art of complexity problems for covering arrays, Theoretical Computer Science](https://www.sciencedirect.com/science/article/pii/S0304397519306486)
7. [Combinatorial testing for software: an adaptation of design of experiments, Measurement](https://www.sciencedirect.com/science/article/abs/pii/S0263224113000596)
8. [NIST: Interactions involved in software failures](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software/combinatorial-methods-in-testing/interactions-involved-in-software-failures)
9. [Montanez-Rivera et al., Evaluation of Fault Detection Effectiveness for Combinatorial and Exhaustive Selection of Discretized Test Inputs, NIST](https://www.nist.gov/publications/evaluation-fault-detection-effectiveness-combinatorial-and-exhaustive-selection)
10. [On the Completion of Partial Combinatorial Test Suites, SN Computer Science](https://link.springer.com/article/10.1007/s42979-025-03937-y)
11. [Leithner et al., State of the CArt: evaluating covering array generators at scale, STTT](https://aisberg.unibg.it/handle/10446/274349)
12. [Covering arrays from maximal sequences over finite fields, arXiv](https://arxiv.org/abs/1708.07828)
13. [Systematic Generation of Diverse Benchmarks for DNN Verification, Springer](https://link.springer.com/chapter/10.1007/978-3-030-53288-8_5)
14. [Dougherty et al., Algorithmic methods for covering arrays of higher index, Journal of Combinatorial Optimization](https://asu.elsevierpure.com/en/publications/algorithmic-methods-for-covering-arrays-of-higher-index/)
15. [Framework for Variability Coverage in Software Product Line Testing](https://www.slideserve.com/lahela/software-product-line-testing-part-iv-a-framework-for-variability-coverage)
16. [Combinatorial Methods in Testing, NIST](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913805)
17. [Top-down: A better strategy for incremental covering array generation, Information and Software Technology](https://www.sciencedirect.com/science/article/pii/S0950584924002064)
18. [NIST Downloadable Tools for combinatorial testing](https://csrc.nist.gov/Projects/Automated-Combinatorial-Testing-for-Software/Downloadable-Tools)
19. [NIST Automated Combinatorial Testing for Software project](https://csrc.nist.gov/projects/automated-combinatorial-testing-for-software)
20. [Covering Arrays, JMP documentation](https://www.jmp.com/support/help/en/18.1/jmp/covering-arrays.shtml)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Combinatorics › Combinatorial design theory

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/covering-array

English original: https://www.edgepedia.org/covering-array
