𝗪𝗵𝗮𝘁 𝗧𝗲𝘀𝘁 𝗚𝗼𝗲𝘀 𝗪𝗵𝗲𝗿𝗲?

Teams often ask the right questions at the wrong layer.

A unit test for a full checkout is too high. A BDD test for a regex is too low. Both tests pass, but neither does its job.

This makes your test suite slow and fragile. You add more tests to fix it. The suite slows down more. Confidence does not improve.

Do not focus on the number of tests. Put each test in the layer where it gives the most confidence for the lowest cost.

Use these four layers:

Pick the cheapest layer to answer your question.

Avoid these mistakes:

A healthy suite does not repeat the same check in every layer. Place each assertion where it gives the most signal.

Write each test where it earns its cost.

Source: https://dev.to/krinosystems/what-test-goes-where-a-practical-guide-to-test-layer-decisions-3079