Skip to content
Learn Netverks
Company prep Darktrace
Mid-level (3–5 years) Technical deep dive Easy

What is the difference between unit and integration tests?

Reported in Darktrace European engineering loops. Testing strategy question covering pyramid, mocks, and confidence vs speed.

Role
SDE
Location
Remote (EU)

Often asked in Darktrace loops at European offices (London, Berlin, Amsterdam, Paris, Stockholm, Dublin, and remote EU). Prepare a clear spoken answer plus key trade-offs.

Try answering aloud first

Cover trade-offs, structure, and a concrete example before revealing the baseline response.

Spoiler-free prep mode

How to frame this at Darktrace: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.

Unit tests verify one function or class in isolation—dependencies mocked. Fast, deterministic, pinpoint failures. Example: pricing logic with fake tax service.

Integration tests exercise real collaborators—database, HTTP client, message queue—often with test containers or in-memory equivalents. Slower but catch wiring, SQL, and schema mismatches unit tests miss.

Test pyramid: many unit, fewer integration, minimal end-to-end UI tests. Invert pyramid ("ice cream cone") when E2E dominates → flaky CI and slow feedback.

Discuss contract tests for microservices, snapshot testing for APIs, and when to use mocks vs fakes. Good teams measure coverage on critical paths, not arbitrary 100% line coverage.

Comments (0)

Share how this question came up in your loop, or add tips for others preparing.

Log in to comment on this question.