Definitions

Unit tests → Integration Tests → Acceptance Tests → End-to-End (E2E, AKA System) Tests

Unit tests should be isolated, automated, fast and repeatable.

A “Unit” can be a function, a class, a module… There’s no one definition.

In DDD this can only be applied to Domain and Application layers

Untitled

Integration tests are for infrastructure/external elements.

They should be paired with Contract Testing to ensure the test doubles you’re using are up-to-date with the real implementations.

Untitled

Acceptance tests check entire flows of vertical slices of your software.

Untitled

E2E tests check the entire system, including infrastructure such as Load Balancers, Databases, Caches, etc…

SUT (Subject Under Test)

The element that is being tested.

Methodologies

Black-box Testing

Clear/White-box Testing

Dealing with legacy/untestable code (seams)

You may encounter instances of code which call methods from objects or places you can’t easily mock or remove, and the original code must remain as-is functionally speaking. In that case, implement seams. Great source

These seams use 2 concepts:

Strategy

Software Testing Strategy