# 冒烟测试（软件）

冒烟测试是一组浅层、快速的检查，用于验证软件构建或已部署系统最关键的功能，以便只有在基本功能正常时才继续更深入、成本更高的测试。ISTQB词汇表将其定义为“一种测试类型，用于获得足够信心，确认测试对象已准备好进行计划中的测试”<sup>[1](https://glossary.istqb.org/en_US/term/smoke-testing?exact_matches_first=true&syllabus_id=23)</sup>。马丁·福勒（Martin Fowler）是软件作者，以撰写关于敏捷开发和持续交付的文章而闻名，他将冒烟测试描述为一种简单测试，确保系统或系统某部分的基本运行，运行快速但完全不全面<sup>[2](https://martinfowler.com/bliki/SmokeTest.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 一种测试类型，用于获得足够信心，确认测试对象已准备好进行计划中的测试（ISTQB）<sup>[1](https://glossary.istqb.org/en_US/term/smoke-testing?exact_matches_first=true&syllabus_id=23)</sup> |
| 常见同义词 | 构建验证测试；谷歌SRE指出冒烟测试也称健全性测试<sup>[3](https://sre.google/sre-book/testing-reliability/)</sup><sup> • </sup><sup>[4](https://developers.google.com/solutions/content-driven/backend/testing)</sup> |
| 范围 | 仅关键功能，广而浅；不旨在提供完整的功能覆盖<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup> |
| 典型检查 | 访问HTTPS端点、查询数据库、模拟单个用户流程<sup>[6](https://learn.microsoft.com/en-us/azure/well-architected/mission-critical/mission-critical-deployment-testing)</sup> |
| 执行位置 | 在部署流水线的每一步之前以及部署到生产环境时运行<sup>[2](https://martinfowler.com/bliki/SmokeTest.html)</sup> |
| 目的 | 当构建从根本上损坏时，提前中止额外且更昂贵的测试<sup>[3](https://sre.google/sre-book/testing-reliability/)</sup> |

## 冒烟测试的作用

冒烟测试套件检查构建是否足够稳定，值得运行其他任何测试。它以很浅的深度覆盖应用的关键用例：微软工程操作手册将冒烟测试描述为初步步骤中验证应用就绪状态的关卡，由集成测试或端到端测试的一个子集构成，以尽量浅的必要深度覆盖尽量多的功能<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup>。如果当前版本未通过，就可以放弃它后续的集成或部署链条，测试正是以此节省时间<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup>。

具体检查刻意平淡无奇。微软的Azure良好架构框架列出常见场景：访问Web应用的HTTPS端点、查询数据库、模拟用户流程，通常只用一个虚拟用户会话，预期结果是系统以预期的值和行为作出响应<sup>[6](https://learn.microsoft.com/en-us/azure/well-architected/mission-critical/mission-critical-deployment-testing)</sup>。福勒的典型例子是一个测试，它建立数据库连接并执行一个简单查询，只检查连接是否可用<sup>[2](https://martinfowler.com/bliki/SmokeTest.html)</sup>。冒烟测试可以是自动化单元测试，也可以是质量保证（QA）团队执行的手动功能测试<sup>[4](https://developers.google.com/solutions/content-driven/backend/testing)</sup>。

## 在流水线中的位置

**在更深入的测试之前。** 谷歌《站点可靠性工程》一书将冒烟测试归为最简单的系统测试之一，工程师在其中测试非常简单但关键的行为；它们的作用是提前中止额外且更昂贵的测试<sup>[3](https://sre.google/sre-book/testing-reliability/)</sup>。冒烟测试失败，意味着对一个无法执行基本功能的构建运行长时间回归测试套件或消耗资源的负载测试毫无意义<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup>。

**在每个部署阶段。** 福勒建议在部署流水线的每一步之前运行冒烟测试，在部署到生产环境时也如此<sup>[2](https://martinfowler.com/bliki/SmokeTest.html)</sup>。Azure针对关键任务工作负载的指导指出，应将冒烟测试作为每次部署的一部分运行，同时配合大量负载、压力和混沌测试来验证性能和可操作性<sup>[6](https://learn.microsoft.com/en-us/azure/well-architected/mission-critical/mission-critical-deployment-testing)</sup>。在生产发布中，冒烟测试可以确认部署没有破坏线上服务，因此可以立即回滚<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup>。操作手册中的典型示例包括：在构建流水线中先运行一小部分集成测试套件，再进行完整覆盖；在负载测试前向产品API发出curl命令并断言返回200响应；在拉取请求验证期间将应用图表部署到测试命名空间<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup>。

**与金丝雀发布的关系。** 冒烟测试和金丝雀发布回答不同的问题。金丝雀部署将新版本暴露给一小部分生产流量，并在继续发布前将其与对照组进行比较<sup>[7](https://sre.google/workbook/canarying-releases/)</sup>。谷歌的SRE书直接区分了二者：配置测试和压力测试在确定性软件上确认特定条件，而金丝雀测试更为临时，将代码暴露给更不可预测的线上生产流量<sup>[3](https://sre.google/sre-book/testing-reliability/)</sup>。

## 与健全性测试和回归测试的关系

这些术语相互重叠，各团队的用法不一。ISTQB词汇表将“健全性测试”列为冒烟测试的同义词<sup>[8](https://www.qtrl.ai/blog/smoke-vs-sanity-vs-regression-testing)</sup>，谷歌的SRE书同样认为冒烟测试又称健全性测试<sup>[3](https://sre.google/sre-book/testing-reliability/)</sup>。

## 每日构建与冒烟测试

这一实践通过微软推广的每日构建与冒烟测试流程，成为一项有正式名称的规范化实践。吉姆·麦卡锡（Jim McCarthy）在《软件开发动力学》（微软出版社，1995）中称每日构建与冒烟测试为产品的心跳<sup>[9](https://flylib.com/books/en/4.442.1.16/1/)</sup>。史蒂夫·麦康奈尔（Steve McConnell）的《快速软件开发》用一章讨论它，描述开发版本在夜间构建中如何被检出、编译、链接并进行冒烟测试；通过的构建被视为良好构建，不过问题仍可能在之后更全面的测试中浮现<sup>[10](https://citeseerx.ist.psu.edu/document?doi=361172c8c16368579ca9b568cd3cda08d1ba5bb8&repid=rep1&type=pdf)</sup>。麦康奈尔还建议即使进度紧张也要构建并运行冒烟测试，因为每日流程会在承压项目中强制执行纪律<sup>[11](https://0-lucas.github.io/digital-garden/99.-Books/McConnell%2C-Steve---Rapid-development_-taming-wild-software-schedules-Microsoft-Press-%282014%29.pdf)</sup>。

## GUI冒烟测试的实证研究

研究人员测量了冒烟测试套件实际能捕获什么。马里兰大学（University of Maryland）计算机科学教授、以GUI测试研究闻名的阿蒂夫·梅蒙（Atif Memon）与谢青（Qing Xie）研究了图形用户界面的冒烟回归测试，提出每日自动化回归测试器（DART），这一流程将GUI冒烟测试从测试用例生成到执行和报告全程自动化<sup>[12](https://www.cs.umd.edu/~atif/papers/MemonTSE2005-abstract.html)</sup>。在ICSM 2004研究中，他们在四个GUI应用的200个植入故障版本上，为每个应用生成5,000到8,000个冒烟测试，足以在一夜内运行，报告了超过4,000,000次测试运行的结果<sup>[13](https://www.cs.umd.edu/~atif/pubs/MemonICSM2004-abstract.html)</sup>。研究结果对该技术作了限定：采用某些测试判定机制的短GUI冒烟测试能检测大量故障，短冒烟测试能执行很大比例的代码，整个流程在执行时间和存储上可行，但有些类别的故障是冒烟测试无法检测的<sup>[13](https://www.cs.umd.edu/~atif/pubs/MemonICSM2004-abstract.html)</sup>。他们后来在期刊上的研究补充说，冒烟测试无法覆盖应用代码的某些部分，而全面的测试判定机制可以弥补较短的冒烟测试用例<sup>[12](https://www.cs.umd.edu/~atif/papers/MemonTSE2005-abstract.html)</sup>。

## 词源

这个名字借自硬件。在电子测试中，冒烟测试指将新硬件直接插入电源通电，看是否冒烟<sup>[14](https://jamesmccaffreyblog.com/2006/04/21/smoke-tests/)</sup>。福勒给出同样的类比：插上电气设备，看看是否冒烟<sup>[2](https://martinfowler.com/bliki/SmokeTest.html)</sup>。另一种说法将该短语追溯到管道工程，那里用烟来查找下水道和管道系统的泄漏，随着20世纪60年代和70年代电子学占据主导，硬件工程师采纳了这个说法<sup>[14](https://jamesmccaffreyblog.com/2006/04/21/smoke-tests/)</sup><sup> • </sup><sup>[15](https://smokestud.io/post-smoke-testing-history.html)</sup>。内德·巴切尔德（Ned Batchelder）是一位以从事Python测试工具相关工作闻名的软件工程师，他指出工程师们开玩笑说要看“魔法烟会不会冒出来”，并补充说与硬件不同，你可以把烟重新放回软件里<sup>[16](https://nedbatchelder.com/blog/200304/smoke_test)</sup>。

## 局限

冒烟测试套件刻意不求穷尽，因此通过它并不能证明整体正确；关于该技术的培训材料指出，其测试用例数量少，意味着其他关键问题不会被发现<sup>[17](https://aif.org/wp-content/uploads/2018/10/Software-Testing-Trng-Module-2018a_MAST.pdf)</sup>。梅蒙和谢的研究从实证上记录了同样的边界，识别出他们的冒烟测试无法检测的故障类别<sup>[13](https://www.cs.umd.edu/~atif/pubs/MemonICSM2004-abstract.html)</sup>。冒烟测试套件还容易受到测试不稳定性的影响，即在代码未更改的情况下测试非确定性地通过和失败；这一现象会拖慢部署流水线，且当它频繁发生时，会导致开发者丢弃失败结果，并侵蚀整个测试套件的价值<sup>[18](https://doi.org/10.1016/j.jss.2023.111837)</sup>。尽管如此，微软的操作手册将这一实践描述为低投入、高影响的步骤，应成为持续集成和持续交付系统中最早实施的阶段之一<sup>[5](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)</sup>。

## References

1. [Smoke testing, ISTQB Glossary](https://glossary.istqb.org/en_US/term/smoke-testing?exact_matches_first=true&syllabus_id=23)
2. [Martin Fowler, SmokeTest (bliki)](https://martinfowler.com/bliki/SmokeTest.html)
3. [Google SRE Book, Testing Reliability](https://sre.google/sre-book/testing-reliability/)
4. [Google for Developers, Testing content-driven web app backends](https://developers.google.com/solutions/content-driven/backend/testing)
5. [Microsoft, code-with-engineering-playbook: Smoke Testing](https://github.com/microsoft/code-with-engineering-playbook/blob/main/docs/automated-testing/smoke-testing/README.md)
6. [Microsoft Azure Well-Architected Framework, Deployment and testing for mission-critical workloads](https://learn.microsoft.com/en-us/azure/well-architected/mission-critical/mission-critical-deployment-testing)
7. [Google SRE Workbook, Canarying Releases](https://sre.google/workbook/canarying-releases/)
8. [QTRL, Smoke vs Sanity vs Regression Testing Explained](https://www.qtrl.ai/blog/smoke-vs-sanity-vs-regression-testing)
9. [The Build Master: Frequent Builds and Smoke Tests Are Mandatory](https://flylib.com/books/en/4.442.1.16/1/)
10. [Memon, Daily builds and smoke testing passage (CiteSeerX copy of IEEE TSE paper)](https://citeseerx.ist.psu.edu/document?doi=361172c8c16368579ca9b568cd3cda08d1ba5bb8&repid=rep1&type=pdf)
11. [Steve McConnell, Rapid Development, Chapter 18: Daily Build and Smoke Test](https://0-lucas.github.io/digital-garden/99.-Books/McConnell%2C-Steve---Rapid-development_-taming-wild-software-schedules-Microsoft-Press-%282014%29.pdf)
12. [Atif M. Memon and Qing Xie (2005), Studying the Fault-Detection Effectiveness of GUI Test Cases for Rapidly Evolving Software, IEEE TSE](https://www.cs.umd.edu/~atif/papers/MemonTSE2005-abstract.html)
13. [Atif M. Memon and Qing Xie (2004), Empirical Evaluation of the Fault-Detection Effectiveness of Smoke Regression Test Cases for GUI-Based Software, ICSM 2004](https://www.cs.umd.edu/~atif/pubs/MemonICSM2004-abstract.html)
14. [James D. McCaffrey, Smoke Tests](https://jamesmccaffreyblog.com/2006/04/21/smoke-tests/)
15. [Smoke Studio, La historia detrás del Smoke Testing](https://smokestud.io/post-smoke-testing-history.html)
16. [Ned Batchelder, Smoke test](https://nedbatchelder.com/blog/200304/smoke_test)
17. [American India Foundation, Software Testing Training Module](https://aif.org/wp-content/uploads/2018/10/Software-Testing-Trng-Module-2018a_MAST.pdf)
18. [Tahir et al. (2023), Test flakiness' causes, detection, impact and responses: A multivocal review, Journal of Systems and Software](https://doi.org/10.1016/j.jss.2023.111837)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Software engineering and development process › Software testing and quality

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/smoke-testing-software

English original: https://www.edgepedia.org/smoke-testing-software
