𝗪𝗵𝗮𝘁 𝗧𝗲𝘀𝘁 𝗚𝗼𝗲𝘀 𝗪𝗵𝗲𝗿𝗲? 𝗔 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗮𝗹 𝗚𝘂𝗶𝗱𝗲 𝘁𝗼 𝗧𝗲𝘀𝘁 𝗟𝗮𝘆𝗲𝗿 𝗗𝗲𝗰𝗶𝘀𝗶𝗼𝗻𝘀

Every test answers a question. Teams often ask the right question at the wrong layer.

A unit test proving a full checkout flow is too high-level. A BDD scenario proving a regex pattern is too low-level.

This makes test suites slow and fragile. You add more tests to fix it. The suite slows down more. Confidence stays low.

Do not maximize the number of tests. Put each test where it gives the most confidence for the least cost.

Use these four layers:

Choose the cheapest layer to answer your question.

Avoid these mistakes:

A healthy suite does not repeat the same check three times. It places each assertion where it gives the most signal.

Write tests where they earn their cost.

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