Python 测试入门
Alexander Levin
Data Scientist
集成测试:一种软件测试方法,用于验证交互是否正常。
集成:系统内两个或多个模块之间的交互。

示例:
潜在的集成问题:
import pytest, os
@pytest.fixture
def setup_file():
# Create temporary file
file = "test_file.txt"
with open(file, "w") as f1:
f1.write("Test data 1")
yield file
os.remove(file)
def test_fs(setup_file):
file = setup_file
# Check that the file was created successfully
assert os.path.exists(file)
集成测试:一种软件测试方法;用于验证集成是否按预期工作。
真实项目包含许多不同的集成。
集成测试有助于预防多种潜在问题。
示例:检查 Python 与文件系统的集成。
Python 测试入门