liveBook · Manning

Integration test

As explained in Software Engineering for Data Scientists

Integration testing checks whether multiple software components work together correctly as a combined system.

An integration test checks whether separate components work correctly when combined. In data science, this matters when work is split across a data pipeline and model code: each part can pass its own checks while their handoff still fails. section 10.1 section 10.1.1

Use integration tests after unit tests have checked individual functions or small code blocks. The goal is not to recheck every isolated prediction or transformation, but to verify that the complete pipeline runs as expected and that outputs from one component can be used by the next. section 10.1.1 section 10.6

A focused integration test can check whether:

  • data produced by a data pipeline is correctly ingested by model code. section 10.1.1
  • data cleaning, feature engineering, model training, and evaluation operate together as intended. section 10.1
  • an end-to-end ML pipeline runs as expected after separately developed pieces are combined. section 10.1.1

Data pipeline to model handoff

One teammate builds data cleaning and feature engineering, while another builds model training and evaluation. Unit tests may confirm that each function behaves as expected. An integration test then combines the work and asks whether the pipeline's data reaches the model code correctly from end to end. section 10.1 section 10.1.1

Integration testing complements rather than replaces other test types. Unit tests focus on a single component; regression tests look for drops in metrics, such as model performance, over time. Integration tests focus on whether components of a codebase function together properly. section 10.1.1 section 10.6

Table 10.1 Here, we show an overview of common types of tests. Unit tests are the most common in automated testing, as they check small components of code to make sure the code functions as expected.
Type of test Example use case

Unit test

Check whether a model prediction matches expected value

Integration test

Test whether the components of an ML pipeline function together as expected.

Exploratory test

Test whether the features of a web app behave as expected

Assertions

Check whether a function returns the correct value for a given set of inputs. This could be a function that is being applied to the elements of several columns for creating a new feature.

Regression test

Test whether the model performance degrades sharply after being rolled out into production

Compare integration tests with unit, exploratory, assertion, and regression checks; the integration example centers on ML-pipeline components functioning together. section 10.1.1

How Software Engineering for Data Scientists covers it

How deep it goes
Defines integration testing through pipeline handoffs and contrasts it with unit and regression tests, without showing an implementation.
Examples
Uses a combined ML pipeline where pipeline data must be correctly ingested by model code.
What you can do after
Evaluate/understand whether separately developed pipeline and model components function together properly.
How it connects
Connects integration testing to unit testing, regression testing, data pipelines, feature engineering, model training, and model evaluation.

Also explained in

Compare how 40 books explain integration test →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Engineering for Data Scientists. The section links point to the parts of the book it draws on.