Skip to content
mentoor

Testing LLM API integrations

For engineers

Mocking providers, replaying recorded responses, forcing failure paths and running small live checks so model calls do not break silently

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

Why should a unit test of your summarising function not call a real model?

Choose one answer

Check yourself · 2 of 5

What does a recorded fixture give you that a hand-written mock does not?

Choose one answer

Check yourself · 3 of 5

Your retry code handles 429 responses. How do you test it without waiting for real backoff delays?

Choose one answer

Check yourself · 4 of 5

What can a scheduled live smoke test catch that mocks and recordings cannot?

Choose one answer

Check yourself · 5 of 5

A mock model always returns clean text. Which code path is most likely to go untested?

Choose one answer

Topics

  1. Mocking the model provider in unit tests4 min read · Replacing the SDK or HTTP layer with a mock that returns fixed text, streams, tool calls or errors
  2. Recording and replaying real API responses4 min read · Cassette-style recording, scrubbing keys and personal data, and refreshing fixtures when a model changes
  3. Testing rate limits, timeouts and malformed output5 min read · Simulating 429 and overloaded errors, stalled and truncated streams and invalid JSON to prove the app recovers
  4. Running budgeted live smoke tests against providers4 min read · A few scheduled real calls that catch model deprecations and API changes, with separate keys and a spend cap

Start here

110 questions · last verified 2026-12