How to build software like an SRE
I like to think I&#x27;m a pretty good architect - my team respects me, I solve a lot of problems that they feel like they can&#x27;t, I read lists like this and if I don&#x27;t follow all the advice, at least most of the advice isn&#x27;t <i>surprising</i>.<p>But there&#x27;s one thing that at this point makes me feel like I&#x27;m taking crazy pills because it seems like I disagree with just about everyone. I think unit tests should be first priority, ahead of integration tests and selenium-ish tests (whether you call them frontend tests, functional tests, whatever)<p>I have experience with all three approaches, but slowly moving from backend to full-stack and frontend, I&#x27;m struck by how many people - it almost seems a consensus at this point - argue that integration tests should be your first line of defense. I&#x27;ve long since given up the battle on this; I&#x27;m not directly on the frontend teams, so I can&#x27;t seagull my way in there and contradict the lead.<p>But I think the point that gets lost on people is that the value of unit tests isn&#x27;t chiefly the output of running the test suite. It&#x27;s that the process of writing good unit tests forces you to write well-structured code. Code that is well-structured enough that it actually minimizes your need for integration and selenium-ish tests. But I feel like in the industry (not just my employer), I&#x27;m surrounded by people who are comfortable with writing integration tests and calling it good, even with spaghetti-code implementations underneath.<p>I&#x27;ve always suspected that the ideal testing setup would be mostly unit tests, integration tests only to fill those gaps, and selenium-ish tests (hopefully rare!) only to fill in the final remaining gaps. But I think the system dynamics are set up such that unit tests are rare (due to wanting to finish the Jira story when the feature starts to work), integration tests are frequent since you can happy-path across a large surface area, and large expensive suites of selenium-ish tests are written by a completely different department since you can write them without having to understand the codebase. It just seems like a recipe for poor overall quality and a <i>lot</i> of wasted work&#x2F;time&#x2F;money.<p>But I&#x27;m clearly in the minority. Maybe I&#x27;m missing something basic that I&#x27;ve somehow never learned in my long career.