Python 測試入門
Alexander Levin
Data Scientist
整合測試:一種軟體測試方法,用來驗證互動是否如常運作。
整合:系統內 2 個以上模組之間的互動。

範例:
可能的整合問題:
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 測試入門