Introduction to Testing in Python
Alexander Levin
Data Scientist
Integration testing - software testing method, that allows to verify that an interaction behaves normally.
Integration - an interaction between 2 or more modules inside of a system.
Examples:
Potential integration problems:
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)
Integration testing - software testing method; allows to verify that an integration works as expected.
Real-life projects include a lot of different integrations in them.
Integration testing helps to prevent lots of potential problems.
Example: checking integration between Python and a file system.
Introduction to Testing in Python