liveBook · Manning

Testing pyramid

As explained in Build Financial Software with Generative AI (From Scratch)

A testing pyramid is a model that organizes software tests by scope, with numerous fast isolated tests at the base and fewer slower broader tests toward the top.

The testing pyramid organizes tests by scope. Build many fast, isolated unit tests at the base, then add fewer broader tests as they become slower, less isolated, and more fragile. section 4.3.1

Move upward as tests involve more of the application:

  • Unit tests exercise code at the base and support frequent development, including test-driven development. section 4.3.1
  • Component tests isolate an API or similar component to find malformed requests and exception cases. section 4.3.1
  • Integration tests check whether multiple components work together despite their additional dependencies. section 4.3.1
  • UI tests automate user-like workflows, while manual and exploratory testing searches for broken behavior and interface inconsistencies. section 4.3.1

Testing a files endpoint

A FastAPI TestClient calls GET /files, then asserts a 200 status and the expected JSON response. A BDD version expresses the same behavior as a feature and step definitions.

How Build Financial Software with Generative AI (From Scratch) covers it

How deep it goes
Defines major layers and their trade-offs, but defers additional testing categories and fuller breakdowns.
Examples
Uses a FastAPI GET /files endpoint, TestClient assertions, a BDD feature, and pytest-bdd step definitions.
What it assumes
Assumes basic software testing awareness and demonstrates endpoint testing without requiring advanced testing theory.
What you can do after
Apply it via FastAPI TestClient and pytest-bdd while choosing test scope according to isolation, speed, dependencies, and fragility.
How it connects
Connects unit testing with component testing, integration testing, UI testing, exploratory testing, and test-driven development.

Also explained in

Compare how 8 books explain testing pyramid →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Financial Software with Generative AI (From Scratch). The section links point to the parts of the book it draws on.