Functional, unit, performance, fault tolerance... Generally speaking, what's the minimum viable amount of types of passing tests required to be reasonably confident automatically deploying on every merge into master?

Depends on your application's risk profile and your organization's risk tolerance.

If there were no risk ie. your code will work 100% of the time addressing the business need perfectly first try, why bother writing tests?

Tests are one way to mitigate risk: the risk of pushing out bugs, of breaking existing code, of breaking teams who depend on your code, of making your code use insane amounts of cpu/memory/disk space/bandwidth, of pushing out stuff that only works for one specific time zone, locale, or culture, etc.

For hackathons, prototypes, and low-criticality systems, not very much. It may not be worth testing at all in some scenarios.

For latency/speed-sensitive systems, it may be worth spending extra time to automate those types of tests. Otherwise, it may be reasonable to skip.

For systems that are safety/financially-critical, it may be worth going beyond testing into the realm of formal methods/modeling.

Remember, tests are there to stop you from shooting yourself in the foot. If you don't care or you're shooting air, skipping tests won't give you a scare. But if they may cry, or someone could die, you'd be a fool not to even try.

/r/learnprogramming Thread